Projet

Général

Profil

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

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

1
<?php
2

    
3
/**
4
 * @file
5
 */
6

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

    
22
function ctools_node_form_book_content_type_render($subtype, $conf, $panel_args, &$context) {
23
  $block = new stdClass();
24
  $block->module = 'node_form';
25

    
26
  $block->title = t('Book outline');
27
  $block->delta = 'book-outline';
28

    
29
  if (isset($context->form)) {
30
    if (isset($context->form['book'])) {
31
      $block->content['book'] = $context->form['book'];
32
      unset($block->content['book']['#pre_render']);
33
      unset($block->content['book']['#theme_wrappers']);
34
      $block->content['book']['#type'] = '';
35

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

    
47
function ctools_node_form_book_content_type_admin_title($subtype, $conf, $context) {
48
  return t('"@s" node form book options', array('@s' => $context->identifier));
49
}
50

    
51
function ctools_node_form_book_content_type_edit_form($form, &$form_state) {
52
  // Provide a blank form so we have a place to have context setting.
53
  return $form;
54
}