Published by Mijingo

movie icon image

EE Insider Blog

Spend your time learning and developing sites with ExpressionEngine and we'll use this blog to keep you informed of all the news related to ExpressionEngine and CodeIgniter.

» Read more in the Archives.

» Have a tip? Send us your EE news.

Learn ExpressionEngine Today

Over a series of 8 videos, watch and learn as Ryan builds an entire ExpressionEngine website from beginning to end. Get started now.

Alter CP Menu with cp_menu_array

Adam Fairholm finds use for a (still undocumented) CP hook (as discovered by Rob Sanchez):

A few days ago Rob Sanchez tweeted a screenshot that caught my eye – a hook called cp_menu_array that is hanging out in expressionengine/libraries/Menu.php like it’s nothing special. It was added in EE 2.1.5.

/* -------------------------------------------
  /* 'cp_menu_array' hook.
  /*  - Modify menu array
  /*  - Added: 2.1.5
  */
   
if ($this->EE->extensions->active_hook('cp_menu_array') === TRUE)
   
{
    $menu 
$this->EE->extensions->call('cp_menu_array'$menu);
   
}
  
/*
  /* -------------------------------------------*/ 

Adam takes the hooks, builds an extension and shows you how to use it to customize the EE CP menus. Kaboom?

Posted on Jul 05, 2011 by Ryan Irelan

Filed Under: Development Tools, EE Add-ons, EE Extensions