Error message

Это обсуждение закрыто: вы не можете добавлять новые комментарии.

Изображения к терминам таксономии

Вчера столкнулся с неработающим обновлением taxonomy_image 6.x-1.6 оказалось, что оно неработающее, ибо при обновлении все старые изображения не переносятся в новую папку, так что остаемся на старой версии.

Также разработал небольшой модуль для вывода этих изображений без вмешательства в тему оформления...

Пока это небольшой набросок, решающий конкретную задачу, думаю довести его до коробочного вида после решения вопроса с taxonomy_image

Пока все сложить в подпапку taxonomy_image/taxonomy_image_term_display

taxonomy_image_term_display.info

; $Id$
name = Taxonomy Image Term Display
description = Display taxonomy images in term node listing where and when you want them.
dependencies[] = taxonomy_image
core = 6.x
package = Taxonomy Image

taxonomy_image_term_display.module

<?php
// $Id$

/**
* @file
*   Display taxonomy images in term node listing where and when you want them.
*/

/**
* Implementation of hook_menu()
*/

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

 

// Add a tab to the Admin Settings
 
$items['admin/settings/taxonomy_image/term_display'] = array(
   
'title' => 'Term Display',
   
'page callback' => 'drupal_get_form',
   
'page arguments' => array('taxonomy_image_term_display_form'),
   
'access arguments' => array('administer site configuration'),
   
'description' => 'Configure Taxonomy_image Term_display functionality.',
   
'type' => MENU_LOCAL_TASK,
   
'weight' => 1,
    );

  return

$items;
}

function

taxonomy_image_term_display_form() {
 
$form = array();

 

$form['taxonomy_image_term_override'] = array(
   
'#type' => 'checkbox',
   
'#title' => t('Override Taxonomy Term Display'),
   
'#default_value' => variable_get('taxonomy_image_term_override', FALSE),
  );

  return

system_settings_form($form);
}

/**
* Implementation of hook_theme()
*/
function taxonomy_image_term_display_theme() {
  return array(
   
'taxonomy_term_page' => array(
     
'arguments' => array('tids' => array(), 'result' => NULL),
     
'template' => 'taxonomy-term-page',
    ),
  );
}

/**
* Process variables for taxonomy-term-page.tpl.php.
*
* The $variables array contains the following arguments:
* - $account
*
* @see user-picture.tpl.php
*/
function template_preprocess_taxonomy_term_page(&$variables) {
 
$variables['override'] = variable_get('taxonomy_image_term_override', FALSE);
 
$tids = $variables['tids'];
 
$result = $variables['result'];

 

drupal_add_css(drupal_get_path('module', 'taxonomy') .'/taxonomy.css');

 

// Only display the description if we have a single term, to avoid clutter and confusion.
 
if (count($tids) == 1) {
   
$term = taxonomy_get_term($tids[0]);
    if (
$term->tid) {
       
$variables['image'] = taxonomy_image_display($term->tid);
    }

   

$output = '';
   
// Check that a description is set.
   
if (!empty($term->description)) {
     
$output .= '<div class="taxonomy-term-description">';
     
$output .= filter_xss_admin($description);
     
$output .= '</div>';
    }
   
$variables['description'] = $output;
  }

 

$variables['nodes'] = taxonomy_render_nodes($result);
}

//function taxonomy_image_term_display
?>

taxonomy-term-page.tpl.php

<?php
if ($override && $image) {
    print
$image;
}

print

$description;

print

$nodes;
?>

Работает после включения модуля и включения admin/settings/taxonomy_image/term_display

Комментарии

Guest аватар

Хорошее начинание

Guest аватар

Автор блога скажите пожалуйста вы оказываете платные консультации по друпалу?

Webmaster аватар

Идея хорошая, но пока никак :(

Guest аватар

А почему никак? Лишние деньги не нужны?

Webmaster аватар

Кроме денег есть еще и время...

Ууух,сколько спама. Грохните эти коменты и ставте модуль CAPTCHA ! А то читать неприятно =\

andypost аватар

бывают атаки спамеров, сейчас тестирую mollom - пока он пропускает такие атаки... когда отключен :) что именно и происходит сегодня. Анонимное комментирование временно разрешено только с модерацией...