user_signature.inc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. 'title' => t('User signature'),
  8. 'icon' => 'icon_user.png',
  9. 'description' => t('The signature of a user.'),
  10. 'required context' => new ctools_context_required(t('User'), 'user'),
  11. 'category' => t('User'),
  12. );
  13. function ctools_user_signature_content_type_render($subtype, $conf, $panel_args, $context) {
  14. $account = isset($context->data) ? clone $context->data : NULL;
  15. $block = new stdClass();
  16. $block->module = 'user-signature';
  17. if ($account === FALSE || ($account->access == 0 && !user_access('administer users'))) {
  18. return;
  19. }
  20. $element['user_signature'] = array(
  21. '#theme' => 'user_signature',
  22. '#signature' => check_markup($account->signature, $account->signature_format),
  23. );
  24. $block->content = $element;
  25. return $block;
  26. }
  27. /**
  28. * Display the administrative title for a panel pane in the drag & drop UI
  29. */
  30. function ctools_user_signature_content_type_admin_title($subtype, $conf, $context) {
  31. return t('"@s" user signature', array('@s' => $context->identifier));
  32. }
  33. function ctools_user_signature_content_type_edit_form($form, &$form_state) {
  34. // provide a blank form so we have a place to have context setting.
  35. return $form;
  36. }