Creating tabbed drupal 6 module

I am creating a module that allows your users to add channels. So I want my code to provide tabs that can be rewritten at the theme level.

I thought this could be done using hook_menu:

$items['tab_add_feed'] = array(
  'title' => 'Add Feed',
  'page callback' => 'xml_parser_add_feed',
  'access callback' => 'user_access',
  'access arguments' => array('manage own feeds'),
  'type' => MENU_LOCAL_TASK,
);

something like above. But I use it on the front of the site.

How to add tabs or links at the top of my page in drupal?

//edit

There are no tabs at the moment, maybe I need to make them visible?

fixed it by adding <a href="xml_parser/add_feed">add feed</a>to the callback function of the main page But this is ugly, hard-coded, not thematic. waiting for a better solution.

//edit

This is the code I'm using now

function xml_parser_menu() {
    $items = array();

    $items['xml_parser'] = array(
            'path' => 'xml_parser',
            'title' => t('Feed'),
            'description' => t('Add/edit feeds'),
            'page callback' => 'xml_parser_manage_overview', 
            'access callback' => 'user_access', // get user access
            'access arguments' => array('manage own feeds'), // check user if premission is set
            'type' => MENU_NORMAL_ITEM,
            'menu_name' => 'primary-links', // add to primary menu
    );

    $items['xml_parser/add_feed'] = array(
            'path' => 'xml_parser/add_feed',
            'title' => 'Add Feed',
            'page callback' => 'xml_parser_add_feed',
            'access callback' => 'user_access',
            'access arguments' => array('manage own feeds'),
            //'access' => user_access('maintain own subscriptions'),
            'type' => MENU_LOCAL_TASK,
    );
    return $items;
}
+3
source share
2

, - "user/%/add_feed", % . , , user_access. . node/%/add_feed, node.

:

function mymodule_init() {
   cache_clear_all();
   menu_router_build();
}

.

, , , . , , , .

+2

. , "/", "/ node" ( ).

, , , $items node/tab_add_feed.

- (.. ), .

0

Source: https://habr.com/ru/post/1772650/


All Articles