Commit 81e5ab6b authored by Cody Craven's avatar Cody Craven
Browse files

Issue #1305682 by codycraven: Add CTools term page display plugin.

parent 95449669
Taxonomy Display 7.x-1.x, YYYY-MM-DD
------------------------------------
Issue #1305682 by codycraven: Add CTools term page display plugin.
Issue #1304536 by codycraven: Make compatible with CTools' page manager.
Issue #1231090 by Jose Reyero, codycraven: Send term page title through
internationalization taxonomy, if it exists.
......
<?php
/**
* Plugins are described by creating a $plugin array which will be used
* by the system that includes this file.
*/
$plugin = array(
'category' => t('Taxonomy term'),
'description' => t('Add a taxonomy term from your site as content.'),
'icon' => 'icon_term.png',
'required context' => new ctools_context_required(t('Term'), array('term', 'taxonomy_term')),
'single' => TRUE,
'title' => t('Term page display'),
);
function taxonomy_display_term_page_display_content_type_admin_title($subtype, $conf, $context) {
return t('"@s" term page display', array('@s' => $context->identifier));
}
function taxonomy_display_term_page_display_content_type_edit_form($form, &$form_state) {
// provide a blank form so we have a place to have context setting.
return $form;
}
function taxonomy_display_term_page_display_content_type_render($subtype, $conf, $panel_args, $context) {
$term = isset($context->data) ? clone($context->data) : NULL;
$block = new stdClass();
$block->module = 'term_page_display';
if ($term) {
$block->title = $term->name;
$block->delta = $term->tid;
$block->content = drupal_render(taxonomy_display_taxonomy_term_page($term));
if (user_access('administer taxonomy')) {
$block->admin_links['update'] = array(
'title' => t('Edit term'),
'alt' => t('Edit this term'),
'href' => 'taxonomy/term/' . $term->tid . '/edit',
'query' => drupal_get_destination(),
);
}
}
else {
$block->delta = 'unknown';
}
return $block;
}
......@@ -5,6 +5,15 @@
* Hooks for the taxonomy display module.
*/
/**
* Implements hook_ctools_plugin_directory().
*/
function taxonomy_display_ctools_plugin_directory($owner, $plugin_type) {
if ($owner == 'ctools' && !empty($plugin_type)) {
return 'plugins/' . $plugin_type;
}
}
/**
* Helper function; delete taxonomy display data.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment