node_type_desc.inc 1.4 KB

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