0

I'm using the Devel module, and the following snippet of code to insert its links into my theme.

<?php echo render($page['devel']); ?>

The result is a h2 element with the Development title in it, and then followed by the links as expected.

I want to hide the title, is it possible at all?


This is what I ended up doing.

<ul id="devel-menu">
    <?php if(array_key_exists('menu_devel', $page['devel'])):?>
        <?php foreach($page['devel']['menu_devel'] as $link):?>
            <?php if(is_array($link) && array_key_exists('#title', $link)):?>
                <li><a href="<?php echo $link['#href'];?>"><?php echo $link['#title'];?></a></li>
            <?php endif;?>
        <?php endforeach;?>
    <?php endif;?>
</ul>

Does this seem acceptable, or is there a preferred way to do this in Drupal?

  • Hard to say without seeing the render array itself, but try $page['devel']['#title_display'] = 'invisible'; before rendering – Clive Feb 6 '13 at 9:15
  • Thanks Clive, I tried this, but it doesn't seem to work at all, I looked through the array for $page['devel'], but theres not an obvious way to hid the title. – josef.van.niekerk Feb 6 '13 at 11:00
0

This is what I ended up doing, and it works 100%:

<ul id="devel-menu">
    <?php if(array_key_exists('menu_devel', $page['devel'])):?>
        <?php foreach($page['devel']['menu_devel'] as $link):?>
            <?php if(is_array($link) && array_key_exists('#title', $link)):?>
                <li><a href="<?php echo $link['#href'];?>"><?php echo $link['#title'];?></a></li>
            <?php endif;?>
        <?php endforeach;?>
    <?php endif;?>
</ul>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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