Projet

Général

Profil

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

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

1
<?php
2

    
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 author information'),
11
  'description' => t('Author information 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_author_content_type_render($subtype, $conf, $panel_args, &$context) {
17
  $block = new stdClass();
18
  $block->module = t('node_form');
19

    
20
  $block->title = t('Authoring information');
21
  $block->delta = 'author-options';
22

    
23
  if (isset($context->form)) {
24
    if (!empty($context->form['author'])) {
25
      $block->content['author'] = $context->form['author'];
26
      if (isset($block->content['author']['#group'])) {
27
        unset($block->content['author']['#pre_render']);
28
        unset($block->content['author']['#theme_wrappers']);
29
        $block->content['author']['#type'] = '';
30
        $block->content['author']['name']['#size'] /= 2;
31
        $block->content['author']['date']['#size'] /= 2;
32
      }
33

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

    
45
function ctools_node_form_author_content_type_admin_title($subtype, $conf, $context) {
46
  return t('"@s" node form author information', array('@s' => $context->identifier));
47
}
48

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