views_empty.inc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * @file
  4. * Allow a view context to display its attachment(s).
  5. */
  6. $plugin = array(
  7. 'title' => t('View empty text'),
  8. 'category' => t('View context'),
  9. 'icon' => 'icon_views_page.png',
  10. 'description' => t('Display the view empty text if there are no results.'),
  11. 'required context' => new ctools_context_required(t('View'), 'view'),
  12. );
  13. /**
  14. * Render the node_terms content type.
  15. */
  16. function views_content_views_empty_content_type_render($subtype, $conf, $panel_args, $context) {
  17. if (empty($context) || empty($context->data)) {
  18. return;
  19. }
  20. // Build the content type block.
  21. $block = new stdClass();
  22. $block->module = 'views_empty';
  23. $block->delta = $context->argument;
  24. $block->title = '';
  25. $block->content = '';
  26. $output = views_content_context_get_output($context);
  27. if (isset($output['empty'])) {
  28. $block->content = $output['empty'];
  29. }
  30. return $block;
  31. }
  32. function views_content_views_empty_content_type_edit_form($form, &$form_state) {
  33. // This form does nothing; it exists to let the main form select the view context.
  34. return $form;
  35. }
  36. function views_content_views_empty_content_type_edit_form_submit(&$form, &$form_state) {
  37. // Kept so we guarantee we have a submit handler.
  38. }
  39. /**
  40. * Returns the administrative title for a type.
  41. */
  42. function views_content_views_empty_content_type_admin_title($subtype, $conf, $context) {
  43. return t('"@context" empty text', array('@context' => $context->identifier));
  44. }