Projet

Général

Profil

Paste
Télécharger (841 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / plugins / relationships / node_edit_form_from_node.inc @ 6e3ce7c2

1
<?php
2

    
3
/**
4
 * @file
5
 * Plugin to provide an relationship handler for term from node.
6
 */
7

    
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
  'title' => t('Node edit form from node'),
14
  'keyword' => 'node_form',
15
  'description' => t('Adds node edit form from a node context.'),
16
  'required context' => new ctools_context_required(t('Node'), 'node'),
17
  'context' => 'ctools_node_edit_form_from_node_context',
18
);
19

    
20
/**
21
 * Return a new context based on an existing context.
22
 */
23
function ctools_node_edit_form_from_node_context($context, $conf) {
24
  if (empty($context->data)) {
25
    return ctools_context_create_empty('node_edit_form', NULL);
26
  }
27

    
28
  if (isset($context->data->nid)) {
29
    return ctools_context_create('node_edit_form', $context->data);
30
  }
31
}