docs icon indicating copy to clipboard operation
docs copied to clipboard

Adding module links in the back-office side menu is not up to date for v1.7.5

Open pabloneruda1 opened this issue 5 years ago • 6 comments

Hello,

would you mind to share the code that is not working?

Thanks

mickaelandrieu avatar Mar 13 '19 23:03 mickaelandrieu

All parts of the code on this page do not work. Settings of public $tabs is completely ignored in v1.7.5.

Only this code works via "install" hook in module class: $tab = new Tab(); $tab->active = 1; $tab->class_name = $className; $tab->name = array(); foreach (Language::getLanguages(true) as $lang) { $tab->name[$lang['id_lang']] = $tabName; } $tab->id_parent = (int) Tab::getIdFromClassName($parentClassName); $tab->module = $moduleName; $tab->add();

pabloneruda1 avatar Mar 14 '19 11:03 pabloneruda1

In legacy controllers this should work but not on modern controllers: can you confirm you're trying to add a tab for a legacy controller or a modern ("Symfony") one?

To speak clearly, controller that doesn't extends Module Controllers can't be managed using the public property named $tabs.

Your workaround in the right to do (in the meantime) in the other cases.

Thanks,

mickaelandrieu avatar Mar 20 '19 13:03 mickaelandrieu

yes,my code not working too `class Etalimama extends Module { protected $config_form = false; public $tabs = array( array( 'name' => 'Collect manage', 'class_name' => 'AdminCollectManage', 'visible' => true, 'parent_class_name' => 'SELL', 'icon' => 'material-icons mi-desktop_mac' )); }

langziyang avatar Jun 07 '19 08:06 langziyang

I think it's worth mentioning Tab::getIdFromClassName (used in example) is marked as deprecated since 1.7.1

Wiatrogon avatar Jun 08 '20 12:06 Wiatrogon

I think the documentation should be modified. Replace: (int) Tab::getIdFromClassName('ShopParameters'); by (int) SymfonyContainer::getInstance()->get('prestashop.core.admin.tab.repository')->findOneIdByClassName('ShopParameters');

ytilotti avatar May 14 '21 07:05 ytilotti