node_form_path.inc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. if (module_exists('path')) {
  3. /**
  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. 'icon' => 'icon_node_form.png',
  10. 'title' => t('Node form url path settings'),
  11. 'description' => t('Publishing options on the Node form.'),
  12. 'required context' => new ctools_context_required(t('Form'), 'node_form'),
  13. 'category' => t('Form'),
  14. );
  15. }
  16. function ctools_node_form_path_content_type_render($subtype, $conf, $panel_args, &$context) {
  17. $block = new stdClass();
  18. $block->module = t('node_form');
  19. $block->title = t('URL path options');
  20. $block->delta = 'url-path-options';
  21. if (isset($context->form)) {
  22. if (isset($context->form['path'])) {
  23. $block->content['path'] = $context->form['path'];
  24. unset($block->content['path']['#pre_render']);
  25. unset($block->content['path']['#theme_wrappers']);
  26. $block->content['path']['#type'] = '';
  27. $block->content['path']['alias']['#size'] /= 2;
  28. // Set access to false on the original rather than removing so that
  29. // vertical tabs doesn't clone it. I think this is due to references.
  30. $context->form['path']['#access'] = FALSE;
  31. }
  32. }
  33. else {
  34. $block->content = t('URL Path options.');
  35. }
  36. return $block;
  37. }
  38. function ctools_node_form_path_content_type_admin_title($subtype, $conf, $context) {
  39. return t('"@s" node form path options', array('@s' => $context->identifier));
  40. }
  41. function ctools_node_form_path_content_type_edit_form($form, &$form_state) {
  42. // provide a blank form so we have a place to have context setting.
  43. return $form;
  44. }