3

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

enter image description here

  • custom tab or magento core tab ?? – Rk Rathod May 24 '19 at 6:26
  • i want hidden custom tab – NewBie May 24 '19 at 6:28
  • you can delete tab also – Rk Rathod May 24 '19 at 6:28
  • No, i just want hidden it. – NewBie May 24 '19 at 6:29
  • because i have conditions – NewBie May 24 '19 at 6:30
0

In Tab File You Can Set Tab Visibility Like This :-

public function canShowTab()
{
    return false;

}
public function isHidden()
{
    return true;

}
  • i can't call function that – NewBie May 24 '19 at 6:38
  • tab is create using ui ?? – Rk Rathod May 24 '19 at 6:42
  • Can you give me example? i an understand :( – NewBie May 24 '19 at 6:45
  • I don't know how to call function that for my tab! – NewBie May 24 '19 at 6:46
  • find in block any tab folder ??? – Rk Rathod May 24 '19 at 6:46
0

In ui_component

It's just a demo

<fieldset name="design">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="visible" xsi:type="boolean">false</item>
            </item>
        </argument>
    </fieldset>

in your code what you need to hide just put like

<item name="visible" xsi:type="boolean">false</item>
  • Yes, i have hidden but just contents still tab not hidden :) – NewBie May 24 '19 at 7:29
0

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">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.