ui component modifier
-
14-04-2021 - |
Question
I'm using Modifier class to disable some ui components on admin screen. But when I implemented modifyMeta() method, some of the needed ui components not included in the metadata array (eg: gallery) So how can I modify these component? T4R.
public function modifyMeta(array $meta)
{
$canEditApplication = ObjectManager::getInstance()->get(AuthorizationInterface::class)->isAllowed('ScPortal_Backend::application_save');
if (!$canEditApplication) {
$meta['product-scheduler']['children']['ew_schedule_start_date']['arguments']['data']['config'] = [
'disabled' => true
];
$meta['product-scheduler']['children']['ew_schedule_end_date']['arguments']['data']['config'] = [
'disabled' => true
];
$meta['product-scheduler']['children']['ew_schedule_status']['arguments']['data']['config'] = [
'disabled' => true
];
$meta['gallery']['arguments']['data']['config'] = [
'componentType' => 'container',
'disabled' => true
];
}
No correct solution
OTHER TIPS
Try this code. hope it helps you.
//use Magento\Framework\Stdlib\ArrayManager;
public function modifyMeta(array $meta)
{
$attribute = 'your attribute code';
$path = $this->arrayManager->findPath($attribute, $meta, null, 'children');
$meta = $this->arrayManager->set(
"{$path}/arguments/data/config/disabled",
$meta,
true
);
return $meta;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange