Projet

Général

Profil

Paste
Télécharger (1,55 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / plugins / content_types / node_form / node_form_book.inc @ 651307cd

1
<?php
2

    
3
if (module_exists('book')) {
4
  /**
5
   * Plugins are described by creating a $plugin array which will be used
6
   * by the system that includes this file.
7
   */
8
  $plugin = array(
9
    'single' => TRUE,
10
    'icon' => 'icon_node_form.png',
11
    'title' => t('Node form book options'),
12
    'description' => t('Book options for the node.'),
13
    'required context' => new ctools_context_required(t('Form'), 'node_form'),
14
    'category' => t('Form'),
15
  );
16
}
17

    
18
function ctools_node_form_book_content_type_render($subtype, $conf, $panel_args, &$context) {
19
  $block = new stdClass();
20
  $block->module = t('node_form');
21

    
22
  $block->title = t('Book outline');
23
  $block->delta = 'book-outline';
24

    
25
  if (isset($context->form)) {
26
    if (isset($context->form['book'])) {
27
      $block->content['book'] = $context->form['book'];
28
      unset($block->content['book']['#pre_render']);
29
      unset($block->content['book']['#theme_wrappers']);
30
      $block->content['book']['#type'] = '';
31

    
32
      // Set access to false on the original rather than removing so that
33
      // vertical tabs doesn't clone it. I think this is due to references.
34
      $context->form['book']['#access'] = FALSE;
35
    }
36
  }
37
  else {
38
    $block->content = t('Book options.');
39
  }
40
  return $block;
41
}
42

    
43
function ctools_node_form_book_content_type_admin_title($subtype, $conf, $context) {
44
  return t('"@s" node form book options', array('@s' => $context->identifier));
45
}
46

    
47
function ctools_node_form_book_content_type_edit_form($form, &$form_state) {
48
  // provide a blank form so we have a place to have context setting.
49
  return $form;
50
}