Projet

Général

Profil

Paste
Télécharger (2,06 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / plugins / content_types / user_form / user_form_actions.inc @ 6e3ce7c2

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_user_form.png',
10
  'title' => t('User form actions / buttons'),
11
  'description' => t('The user form actions / buttons.'),
12
  'required context' => new ctools_context_required(t('Form'), 'form'),
13
  'category' => t('Form'),
14
);
15

    
16
/**
17
 * Ctools plugin content type render for the picture form field.
18
 */
19
function ctools_user_form_actions_content_type_render($subtype, $conf, $panel_args, &$context) {
20
  $block = new stdClass();
21
  $block->module = t('user-form');
22

    
23
  $block->delta = 'title-options';
24

    
25
  if (isset($context->form)) {
26
    if (!empty($context->form['actions'])) {
27
      $block->content['actions'] = $context->form['actions'];
28
      unset($context->form['actions']);
29
    }
30
    // Because we are adding the submit buttons outside the General form
31
    // we can assume the necessary hidden components should be added as well.
32
    if (!empty($context->form['form_build_id'])) {
33
      $block->content['form_build_id'] = $context->form['form_build_id'];
34
      unset($context->form['form_build_id']);
35
    }
36
    if (!empty($context->form['form_token'])) {
37
      $block->content['form_token'] = $context->form['form_token'];
38
      unset($context->form['form_token']);
39
    }
40
    if (!empty($context->form['form_id'])) {
41
      $block->content['form_id'] = $context->form['form_id'];
42
      unset($context->form['form_id']);
43
    }
44
  }
45
  else {
46
    $block->content = t('User actions / buttons form components.');
47
  }
48
  return $block;
49
}
50

    
51
/**
52
 * Ctools plugin admin title function for the actions form field.
53
 */
54
function ctools_user_form_actions_content_type_admin_title($subtype, $conf, $context) {
55
  return t('"@s" user form actions / buttons field', array('@s' => $context->identifier));
56
}
57

    
58
/**
59
 * Ctools plugin configuration edit form for the actions form field.
60
 *
61
 * Provide a blank form so we have a place to have context setting.
62
 */
63
function ctools_user_form_actions_content_type_edit_form($form, &$form_state) {
64
  return $form;
65
}