[support] hook_menu() [WAS: (no subject)]

Earnie Boyd earnie at users.sourceforge.net
Fri Feb 15 15:34:25 UTC 2013


You need to take a look into the "load arguments" element of the $items[] array.

You also shouldn't load an item for each $workflow-wid but replace
that with a %wid instead or maybe (%workflow_wid).

The actions would become %wid/state, %wid/edit, etc.; this is what the
examples give.

HTH,
Earnie

On Fri, Feb 15, 2013 at 8:44 AM, Ms. Nancy Wichmann
<nan_wich at bellsouth.net> wrote:
> I have this code in my hook_menu(), and it works just like I would like.
>
>   foreach (workflow_get_workflows() as $workflow) {
>     $items["admin/config/workflow/workflow/$workflow->wid"] = array(
>       'title' => check_plain($workflow->name),
>       'weight' => $workflow->wid,
>       'access arguments' => array('administer workflow'),
>       'page callback' => 'workflow_admin_ui_overview',
>       'page arguments' => array(4),
>       'type' => MENU_LOCAL_TASK,
>       );
>   // @TODO: Put "links" here as MENU_LOCAL_ACTION items?
>   }
>
> I'd like to turn these links into action links at the top of each of the
> pages above.
> I created a menu item with MENU_LOCAL_ACTION but they didn't show up.
>   $links = array(
>     'workflow_overview_add_state' => array(
>       'title' => t('Add state'),
>       'href' => "admin/config/workflow/workflow/state/$workflow->wid",
>       ),
>     'workflow_overview_edit' => array(
>       'title' => t('Edit'),
>       'href' => "admin/config/workflow/workflow/edit/$workflow->wid",
>       ),
>     'workflow_overview_delete' => array(
>       'title' => t('Delete'),
>       'href' => "admin/config/workflow/workflow/delete/$workflow->wid",
>       ),
>     );
>
> Does anyone have any tips on this? Do they have to be exactly the same path
> with an argument
> on the end?
>
> Nancy
>
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]



-- 
Earnie
-- https://sites.google.com/site/earnieboyd


More information about the support mailing list