Projet

Général

Profil

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

root / drupal7 / sites / all / modules / ctools / plugins / relationships / user_category_edit_form_from_user.inc @ 13755f8d

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('User category edit form from user'),
14
  'keyword' => 'user_category_form',
15
  'description' => t('Adds user category edit form from a user context.'),
16
  'required context' => new ctools_context_required(t('User'), 'user'),
17
  'context' => 'ctools_user_category_edit_form_from_user_context',
18
);
19

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

    
28
  if (isset($context->data->user_category)) {
29
    return ctools_context_create('user_edit_form', $context->data, array('category' => $context->data->user_category));
30
  }
31
}