AbanteCart Community

AbanteCart Development => Extensions and Add-Ons => Topic started by: Bard00k on July 15, 2016, 04:10:51 PM

Title: Adding new admin menu (AMenu insertMenuItem) icon
Post by: Bard00k on July 15, 2016, 04:10:51 PM
Hello everyone,

I'm trying to build an extension that includes an admin dashboard page and have its own button on the left navbar.
I tried the following code in my installation script (php):


$menu = new AMenu ( "admin" );
$menu->insertMenuItem ( array (  "item_id" => "extension_id",
                   "parent_id" => null,   
                   "item_text" => "Extension Name",
                   "item_url" => "extension_unique_name",
                   "item_type"=>"core",
                   "sort_order"=>"0")
               );

$data = array('language_id' => 0,
'section' => 1,
'block' => 'common/header',
'language_key' => 'extension_id',
'language_value' => 'Extension Name');


And it creates a menu like expected. However, now I want to set an icon instead of the default triangle.
I looked at the code and it expects a 'item_icon_rl_id' key, but I couldn't find in the doc what kind of value this param accept and where can I find a list of possible icon options?

Thanks! :)
Title: Re: Adding new admin menu (AMenu insertMenuItem) icon
Post by: Bard00k on July 16, 2016, 12:43:16 AM
Replying self:

// add new menu item
$rm = new AResourceManager();
$rm->setType('image');

// create resource for the menu icon
$data = array();
$data['resource_code'] = '<i class="fa fa-signal"></i>&nbsp;';
$data['name'] = array($language_id => 'Menu Icon MenuName');
$data['title'] = array($language_id => '');
$data['description'] = array($language_id => '');
$resource_menu_icon_id = $rm->addResource($data);

And then using $resource_menu_icon_id works.
Title: Re: Adding new admin menu (AMenu insertMenuItem) icon
Post by: Basara on July 18, 2016, 01:36:07 AM
Thank you for update with solution  :D