Magento – Magento 2: How to hidden tab fieldset in form ui component

formsmagento2tabsuicomponent

i want hide this field. everyone can help me plz!
enter image description here

enter image description here

Best Answer

You should be able to use the method isComponentVisible()

namespace Custom\Custom\Ui\Component\Form;

use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\ComponentVisibilityInterface;
use Magento\Ui\Component\Form\Fieldset;

/**
 * Class Fieldset
 * @package Custom\Custom\Ui\Component\Form
 */
class CustomFieldset extends Fieldset implements ComponentVisibilityInterface
{
    /**
     * CustomFieldset constructor.
     * @param ContextInterface $context
     * @param array $components
     * @param array $data
     */
    public function __construct(
        ContextInterface $context,
        array $components = [],
        array $data = []
    ) {
        $this->context = $context;

        parent::__construct($context, $components, $data);
    }

    /**
     * @return bool
     */
    public function isComponentVisible(): bool
    {
        $visible = //add logic
        return (bool)$visible;
    }
}

And in your xml you just need to include this class in the fieldset

<fieldset name="custom" sortOrder="30" class="Custom\Custom\Ui\Component\Form\CustomFieldset">
Related Topic