| 1 |
<?php |
<?php |
| 2 |
// $Id: menu.inc,v 1.357 2009/10/17 11:39:15 dries Exp $ |
// $Id: menu.inc,v 1.358 2009/11/01 23:02:13 webchick Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 1796 |
* If the path "node/123" is passed to this function, then it will return the |
* If the path "node/123" is passed to this function, then it will return the |
| 1797 |
* links for 'edit' and 'report-as-spam'. |
* links for 'edit' and 'report-as-spam'. |
| 1798 |
* |
* |
| 1799 |
|
* @param $module |
| 1800 |
|
* The name of the implementing module. This is used to prefix the key for |
| 1801 |
|
* each contextual link, which is transformed into a CSS class during |
| 1802 |
|
* rendering by theme_links(). For example, if $module is 'block' and the |
| 1803 |
|
* retrieved local task path argument is 'edit', then the resulting CSS class |
| 1804 |
|
* will be 'block-edit'. |
| 1805 |
* @param $path |
* @param $path |
| 1806 |
* The menu router path of the object to retrieve local tasks for, for example |
* The static menu router path of the object to retrieve local tasks for, for |
| 1807 |
* "node/123" or "admin/structure/menu/manage/[menu_name]". |
* example 'node' or 'admin/structure/block/manage'. |
| 1808 |
|
* @param $args |
| 1809 |
|
* A list of of dynamic path arguments to append to $path to form the fully- |
| 1810 |
|
* qualified menu router path, for example array(123) for a certain node or |
| 1811 |
|
* array('system', 'navigation') for a certain block. |
| 1812 |
* |
* |
| 1813 |
* @return |
* @return |
| 1814 |
* A list of menu router items that are local tasks for the passed in path. |
* A list of menu router items that are local tasks for the passed in path. |
| 1815 |
* |
* |
| 1816 |
* @see system_preprocess() |
* @see system_preprocess() |
| 1817 |
*/ |
*/ |
| 1818 |
function menu_contextual_links($parent_path, $args) { |
function menu_contextual_links($module, $parent_path, $args) { |
| 1819 |
static $path_empty = array(); |
static $path_empty = array(); |
| 1820 |
|
|
| 1821 |
$links = array(); |
$links = array(); |
| 1861 |
if (!$item['access']) { |
if (!$item['access']) { |
| 1862 |
continue; |
continue; |
| 1863 |
} |
} |
| 1864 |
// All contextual links are keyed by the actual "task" path argument. The |
// All contextual links are keyed by the actual "task" path argument, |
| 1865 |
// menu system does not allow for two local tasks with the same name, and |
// prefixed with the name of the implementing module. |
| 1866 |
// since the key is also used as CSS class for the link item, which may be |
$links[$module . '-' . $key] = $item; |
|
// styled as icon, it wouldn't make sense to display the same icon for |
|
|
// different tasks. |
|
|
$links[$key] = $item; |
|
| 1867 |
} |
} |
| 1868 |
|
|
| 1869 |
// Allow modules to alter contextual links. |
// Allow modules to alter contextual links. |