0

This question is extension of this question: Current Username title instead Secondary menu title, but it is different.

I would like to how can I override the following part of code theme('links__system_secondary_menu',............) which is in page.tpl.php

For example, if I want to change text => t('Secondary menu') to text => t('Any new text').


One way to do this, which I think is just change that part in page.tpl.php and it works perfectly.

OR

Is there any other way like hook-way to do this, so we can write function in template.php and that override only that part?

from page.tpl.php

<?php if ($secondary_menu): ?>
      <div id="secondary-menu" class="navigation">
        <?php print theme('links__system_secondary_menu', array(
          'links' => $secondary_menu,
          'attributes' => array(
            'id' => 'secondary-menu-links',
            'class' => array('links', 'inline', 'clearfix'),
          ),
          'heading' => array(
            'text' => t('Secondary menu'),
            'level' => 'h2',
            'class' => array('element-invisible'),
          ),
        )); ?>
      </div> <!-- /#secondary-menu -->
    <?php endif; ?>

Thanks,

1 Answer 1

2

You can override theme_links__system_secondary_menu() in template.php. You will name it MODULENAME_links__system_secondary_menu(), and the original code can be seen here: https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_links/7.x

Copy that code, and modify it as necessary.

1
  • Its perfect....
    – CodeNext
    Commented Oct 4, 2016 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.