Projet

Général

Profil

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

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

1
<?php
2

    
3
if (module_exists('upload')) {
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 file attachments'),
12
    'description' => t('File attachments on the Node form.'),
13
    'required context' => new ctools_context_required(t('Form'), 'node_form'),
14
    'category' => t('Form'),
15
  );
16
}
17

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

    
22
  $block->title = t('Attach files');
23
  $block->delta = 'url-path-options';
24

    
25
  if (isset($context->form)) {
26
    if (isset($context->form['attachments'])) {
27
      $block->content = $context->form['attachments'];
28
      if (isset($block->content['attachments']['#group'])) {
29
        unset($block->content['attachments']['#pre_render']);
30
        unset($block->content['attachments']['#theme_wrappers']);
31
        $block->content['attachments']['#type'] = '';
32
      }
33
      // Set access to false on the original rather than removing so that
34
      // vertical tabs doesn't clone it. I think this is due to references.
35
      $context->form['attachments']['#access'] = FALSE;
36
    }
37
  }
38
  else {
39
    $block->content = t('Attach files.');
40
  }
41
  return $block;
42
}
43

    
44
function ctools_node_form_attachments_content_type_admin_title($subtype, $conf, $context) {
45
  return t('"@s" node form attach files', array('@s' => $context->identifier));
46
}
47

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