Projet

Général

Profil

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

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

1
<?php
2

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

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

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

    
26
  $block->title = t('Attach files');
27
  $block->delta = 'url-path-options';
28

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

    
48
function ctools_node_form_attachments_content_type_admin_title($subtype, $conf, $context) {
49
  return t('"@s" node form attach files', array('@s' => $context->identifier));
50
}
51

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