node_type_desc.inc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * @file
  4. * Plugins are described by creating a $plugin array which will be used
  5. * by the system that includes this file.
  6. */
  7. $plugin = array(
  8. 'single' => TRUE,
  9. 'title' => t('Node type description'),
  10. 'icon' => 'icon_node.png',
  11. 'description' => t('Node type description.'),
  12. 'required context' => new ctools_context_required(t('Node'), 'node'),
  13. 'category' => t('Node'),
  14. );
  15. /**
  16. * Output function for the 'node' content type. Outputs a node
  17. * based on the module and delta supplied in the configuration.
  18. */
  19. function ctools_node_type_desc_content_type_render($subtype, $conf, $panel_args, $context) {
  20. $node = isset($context->data) ? clone $context->data : NULL;
  21. $block = new stdClass();
  22. $block->module = 'node_type';
  23. if ($node) {
  24. $type = node_type_get_type($node);
  25. $block->title = $type->name;
  26. $block->content = filter_xss_admin($type->description);
  27. $block->delta = $node->type;
  28. }
  29. else {
  30. $block->title = t('Node type description');
  31. $block->content = t('Node type description goes here.');
  32. $block->delta = 'unknown';
  33. }
  34. return $block;
  35. }
  36. function ctools_node_type_desc_content_type_admin_title($subtype, $conf, $context) {
  37. return t('"@s" type description', array('@s' => $context->identifier));
  38. }
  39. function ctools_node_type_desc_content_type_edit_form($form, &$form_state) {
  40. // Provide a blank form so we have a place to have context setting.
  41. return $form;
  42. }