Author Topic: Adding new admin menu (AMenu insertMenuItem) icon  (Read 4205 times)

Offline Bard00k

  • Newbie
  • *
  • Posts: 5
  • Karma: +2/-0
    • View Profile
Adding new admin menu (AMenu insertMenuItem) icon
« 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! :)

Offline Bard00k

  • Newbie
  • *
  • Posts: 5
  • Karma: +2/-0
    • View Profile
Re: Adding new admin menu (AMenu insertMenuItem) icon
« Reply #1 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.

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5774
  • Karma: +274/-2
    • View Profile
Re: Adding new admin menu (AMenu insertMenuItem) icon
« Reply #2 on: July 18, 2016, 01:36:07 AM »
Thank you for update with solution  :D

 

Powered by SMFPacks Social Login Mod