Révision 503b3f7b
Ajouté par Assos Assos il y a environ 10 ans
drupal7/sites/all/modules/entity/modules/callbacks.inc | ||
---|---|---|
20 | 20 |
* @see entity_metadata_book_entity_info_alter() |
21 | 21 |
*/ |
22 | 22 |
function entity_metadata_book_get_properties($node, array $options, $name, $entity_type) { |
23 |
if (!isset($node->book['bid'])) { |
|
24 |
throw new EntityMetadataWrapperException('This node is no book page.'); |
|
25 |
} |
|
26 | 23 |
switch ($name) { |
27 | 24 |
case 'book': |
28 |
return $node->book['bid']; |
|
25 |
if (isset($node->book['bid'])) { |
|
26 |
return $node->book['bid']; |
|
27 |
} |
|
28 |
return NULL; |
|
29 | 29 |
|
30 | 30 |
case 'book_ancestors': |
31 | 31 |
$ancestors = array(); |
... | ... | |
92 | 92 |
|
93 | 93 |
case 'comment_count_new': |
94 | 94 |
return comment_num_new($node->nid); |
95 |
|
|
96 |
case 'comments': |
|
97 |
$select = db_select('comment', 'c') |
|
98 |
->fields('c', array('cid')) |
|
99 |
->condition('c.nid', $node->nid); |
|
100 |
return array_keys($select->execute()->fetchAllKeyed(0, 0)); |
|
95 | 101 |
} |
96 | 102 |
} |
97 | 103 |
|
... | ... | |
413 | 419 |
$list = array(); |
414 | 420 |
$list[LANGUAGE_NONE] = t('Language neutral'); |
415 | 421 |
foreach (language_list() as $language) { |
416 |
$list[$language->language] = $language->name;
|
|
422 |
$list[$language->language] = t($language->name);
|
|
417 | 423 |
} |
418 | 424 |
return $list; |
419 | 425 |
} |
... | ... | |
972 | 978 |
* Callback to get the form of a user account. |
973 | 979 |
*/ |
974 | 980 |
function entity_metadata_form_user($account) { |
975 |
// Pre-populate the form-state with the right form include. |
|
981 |
// If $account->uid is set then we want a user edit form. |
|
982 |
// Otherwise we want the user register form. |
|
983 |
if (isset($account->uid)) { |
|
984 |
$form_id = 'user_profile_form'; |
|
985 |
form_load_include($form_state, 'inc', 'user', 'user.pages'); |
|
986 |
} |
|
987 |
else { |
|
988 |
$form_id = 'user_register_form'; |
|
989 |
} |
|
976 | 990 |
$form_state['build_info']['args'] = array($account); |
977 |
form_load_include($form_state, 'inc', 'user', 'user.pages'); |
|
978 |
return drupal_build_form('user_profile_form', $form_state); |
|
991 |
return drupal_build_form($form_id, $form_state); |
|
979 | 992 |
} |
980 | 993 |
|
981 | 994 |
/** |
Formats disponibles : Unified diff
Weekly update of contrib modules