Созонов Алексей

Веб-разработчик

Показывать блок только если введённый PHP-код возвращает значение TRUE

09.08.2015

Показывать блок если тип содержимого - story

<?php
  // Only show if $return is true
  $return = FALSE;

  // Match current node type with story
  if ( (arg(0) == 'node') && is_numeric(arg(1)) )  {
    $nid = arg(1);
    $node = node_load($nid);
    $type = $node->type;
    if($type == "story") {
       $return = TRUE;
    }
  }

  return $return;

#Drupal