summaryrefslogtreecommitdiff
path: root/sites/all/modules/ctools/plugins/relationships/node_edit_form_from_node.inc
blob: 15c758a227f1fb81beb937158447d7f3d66b72c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

/**
 * @file
 * Plugin to provide an relationship handler for term from node.
 */

/**
 * Plugins are described by creating a $plugin array which will be used
 * by the system that includes this file.
 */
$plugin = array(
  'title' => t('Node edit form from node'),
  'keyword' => 'node_form',
  'description' => t('Adds node edit form from a node context.'),
  'required context' => new ctools_context_required(t('Node'), 'node'),
  'context' => 'ctools_node_edit_form_from_node_context',
);

/**
 * Return a new context based on an existing context.
 */
function ctools_node_edit_form_from_node_context($context, $conf) {
  if (empty($context->data)) {
    return ctools_context_create_empty('node_edit_form', NULL);
  }

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