First You need create block extents class Magento\Framework\View\Element\Html\Link\Current
After that use use it in to your template view/layout/frontend/customer_account.xml like this
<referenceBlock name="customer_account_navigation">
<block class="Namespace\Module\Block\View\Element\Html\Link\Current" name="customer-account-customfield-index-link">
<arguments>
<argument name="path" xsi:type="string">mymodule/customfields</argument>
<argument name="label" xsi:type="string" translate="true">Identity Proof</argument>
</arguments>
</block>
</referenceBlock>
Then overwrite function toHtml() like this
public function toHtml(){
if($this->_customerSession->getCustomer()->getYourAttribute()){
return parent::toHtml();
}
return '';
}
Which full block code
namespace Namespace\Module\Block\View\Element\Html\Link;
use Magento\Customer\Model\Session as CustomerSession;
class Current extends \Magento\Framework\View\Element\Html\Link\Current{
protected $_customerSession;
/**
* Constructor
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Framework\App\DefaultPathInterface $defaultPath
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\App\DefaultPathInterface $defaultPath,
CustomerSession $CustomerSession,
array $data = []
) {
parent::__construct($context, $data);
$this->_defaultPath = $defaultPath;
$this->_customerSession = $CustomerSession;
}
public function toHtml(){
if($this->_customerSession->getCustomer()->getYourAttribute()){
return parent::toHtml();
}
return '';
}
}