Drupal 6. Alter links

Julia 15/03/2009

Как убрать лишнюю ссылку из ссылок к ноду.

Есть два варианта:

Через модуль

<?php

function mymodule_link_alter(&$links, $node) {
  foreach (
$links as $module => $link) {
    if (
strstr($module, 'blog')) {
      unset(
$links[$module]);
    }
  }
}

?>

В теме

В файле template.php:

<?php
function phptemplate_preprocess_node(&$vars) {  

// unset from links forward link
  
foreach ($vars['node']->links as $module => $link) {
        if (
$module == 'forward_links') {
          unset(
$vars['node']->links[$module]);
        }
      }
  
$vars['links'] = theme('links', $vars['node']->links, array('class' => 'links inline'));
}
?>

тэги:

Спасибо, оказалось всё просто, а я голову ломал...

---
химический анкер

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options