node_form_path.inc 1.6 KB

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