Révision 4444412d
Ajouté par Julien Enselme il y a presque 10 ans
drupal7/modules/field/field.api.php | ||
---|---|---|
1 | 1 |
<?php |
2 |
/** |
|
3 |
* @file |
|
4 |
* Hooks provided by the Field module. |
|
5 |
*/ |
|
2 | 6 |
|
3 | 7 |
/** |
4 | 8 |
* @addtogroup hooks |
... | ... | |
37 | 41 |
* - delete: (optional) String containing markup (normally a link) used as the |
38 | 42 |
* element's 'delete' operation in the administration interface. Only for |
39 | 43 |
* 'form' context. |
44 |
* |
|
45 |
* @ingroup field_types |
|
40 | 46 |
*/ |
41 | 47 |
function hook_field_extra_fields() { |
42 | 48 |
$extra['node']['poll'] = array( |
... | ... | |
76 | 82 |
* The associative array of 'pseudo-field' components. |
77 | 83 |
* |
78 | 84 |
* @see hook_field_extra_fields() |
85 |
* |
|
86 |
* @ingroup field_types |
|
79 | 87 |
*/ |
80 | 88 |
function hook_field_extra_fields_alter(&$info) { |
81 | 89 |
// Force node title to always be at the top of the list by default. |
... | ... | |
656 | 664 |
* The source entity from which field values are being copied. |
657 | 665 |
* @param $source_langcode |
658 | 666 |
* The source language from which field values are being copied. |
667 |
* |
|
668 |
* @ingroup field_language |
|
659 | 669 |
*/ |
660 | 670 |
function hook_field_prepare_translation($entity_type, $entity, $field, $instance, $langcode, &$items, $source_entity, $source_langcode) { |
661 | 671 |
// If the translating user is not permitted to use the assigned text format, |
... | ... | |
1250 | 1260 |
*/ |
1251 | 1261 |
|
1252 | 1262 |
/** |
1253 |
* @ingroup field_attach
|
|
1263 |
* @addtogroup field_attach
|
|
1254 | 1264 |
* @{ |
1255 | 1265 |
*/ |
1256 | 1266 |
|
... | ... | |
1312 | 1322 |
* This hook is invoked after the field module has performed the operation. |
1313 | 1323 |
* |
1314 | 1324 |
* See field_attach_validate() for details and arguments. |
1325 |
* |
|
1326 |
* @param $entity_type |
|
1327 |
* The type of $entity; e.g., 'node' or 'user'. |
|
1328 |
* @param $entity |
|
1329 |
* The entity with fields to validate. |
|
1330 |
* @param array $errors |
|
1331 |
* An associative array of errors keyed by field_name, language, delta. |
|
1315 | 1332 |
*/ |
1316 | 1333 |
function hook_field_attach_validate($entity_type, $entity, &$errors) { |
1317 | 1334 |
// @todo Needs function body. |
... | ... | |
1516 | 1533 |
* - entity_type: The type of the entity to be displayed. |
1517 | 1534 |
* - entity: The entity with fields to render. |
1518 | 1535 |
* - langcode: The language code $entity has to be displayed in. |
1536 |
* |
|
1537 |
* @ingroup field_language |
|
1519 | 1538 |
*/ |
1520 | 1539 |
function hook_field_language_alter(&$display_language, $context) { |
1521 | 1540 |
// Do not apply core language fallback rules if they are disabled or if Locale |
... | ... | |
1537 | 1556 |
* An associative array containing: |
1538 | 1557 |
* - entity_type: The type of the entity the field is attached to. |
1539 | 1558 |
* - field: A field data structure. |
1559 |
* |
|
1560 |
* @ingroup field_language |
|
1540 | 1561 |
*/ |
1541 | 1562 |
function hook_field_available_languages_alter(&$languages, $context) { |
1542 | 1563 |
// Add an unavailable language. |
... | ... | |
1587 | 1608 |
* @param $entity_type |
1588 | 1609 |
* The type of entity; for example, 'node' or 'user'. |
1589 | 1610 |
* @param $bundle |
1590 |
* The bundle that was just deleted. |
|
1611 |
* The name of the bundle that was just deleted.
|
|
1591 | 1612 |
* @param $instances |
1592 | 1613 |
* An array of all instances that existed for the bundle before it was |
1593 | 1614 |
* deleted. |
... | ... | |
1602 | 1623 |
} |
1603 | 1624 |
|
1604 | 1625 |
/** |
1605 |
* @} End of "defgroup field_attach".
|
|
1626 |
* @} End of "addtogroup field_attach".
|
|
1606 | 1627 |
*/ |
1607 | 1628 |
|
1608 | 1629 |
/** |
... | ... | |
2262 | 2283 |
} |
2263 | 2284 |
} |
2264 | 2285 |
|
2286 |
/** |
|
2287 |
* @} End of "addtogroup field_storage |
|
2288 |
*/ |
|
2289 |
|
|
2265 | 2290 |
/** |
2266 | 2291 |
* Returns the maximum weight for the entity components handled by the module. |
2267 | 2292 |
* |
... | ... | |
2275 | 2300 |
* @param $context |
2276 | 2301 |
* The context for which the maximum weight is requested. Either 'form', or |
2277 | 2302 |
* the name of a view mode. |
2303 |
* |
|
2278 | 2304 |
* @return |
2279 | 2305 |
* The maximum weight of the entity's components, or NULL if no components |
2280 | 2306 |
* were found. |
2307 |
* |
|
2308 |
* @ingroup field_info |
|
2281 | 2309 |
*/ |
2282 | 2310 |
function hook_field_info_max_weight($entity_type, $bundle, $context) { |
2283 | 2311 |
$weights = array(); |
... | ... | |
2289 | 2317 |
return $weights ? max($weights) : NULL; |
2290 | 2318 |
} |
2291 | 2319 |
|
2320 |
/** |
|
2321 |
* @addtogroup field_types |
|
2322 |
* @{ |
|
2323 |
*/ |
|
2324 |
|
|
2292 | 2325 |
/** |
2293 | 2326 |
* Alters the display settings of a field before it gets displayed. |
2294 | 2327 |
* |
... | ... | |
2355 | 2388 |
} |
2356 | 2389 |
} |
2357 | 2390 |
|
2391 |
/** |
|
2392 |
* @} End of "addtogroup field_types |
|
2393 |
*/ |
|
2394 |
|
|
2358 | 2395 |
/** |
2359 | 2396 |
* Alters the display settings of pseudo-fields before an entity is displayed. |
2360 | 2397 |
* |
... | ... | |
2370 | 2407 |
* - entity_type: The entity type; e.g., 'node' or 'user'. |
2371 | 2408 |
* - bundle: The bundle name. |
2372 | 2409 |
* - view_mode: The view mode, e.g. 'full', 'teaser'... |
2410 |
* |
|
2411 |
* @ingroup field_types |
|
2373 | 2412 |
*/ |
2374 | 2413 |
function hook_field_extra_fields_display_alter(&$displays, $context) { |
2375 | 2414 |
if ($context['entity_type'] == 'taxonomy_term' && $context['view_mode'] == 'full') { |
... | ... | |
2399 | 2438 |
* - instance: The instance of the field. |
2400 | 2439 |
* |
2401 | 2440 |
* @see hook_field_widget_properties_alter() |
2441 |
* |
|
2442 |
* @ingroup field_widget |
|
2402 | 2443 |
*/ |
2403 | 2444 |
function hook_field_widget_properties_ENTITY_TYPE_alter(&$widget, $context) { |
2404 | 2445 |
// Change a widget's type according to the time of day. |
... | ... | |
2409 | 2450 |
} |
2410 | 2451 |
} |
2411 | 2452 |
|
2412 |
/** |
|
2413 |
* @} End of "addtogroup field_storage". |
|
2414 |
*/ |
|
2415 |
|
|
2416 | 2453 |
/** |
2417 | 2454 |
* @addtogroup field_crud |
2418 | 2455 |
* @{ |
... | ... | |
2608 | 2645 |
* |
2609 | 2646 |
* @param $field |
2610 | 2647 |
* The field being purged. |
2648 |
* |
|
2649 |
* @ingroup field_storage |
|
2611 | 2650 |
*/ |
2612 | 2651 |
function hook_field_storage_purge_field($field) { |
2613 | 2652 |
$table_name = _field_sql_storage_tablename($field); |
... | ... | |
2625 | 2664 |
* |
2626 | 2665 |
* @param $instance |
2627 | 2666 |
* The instance being purged. |
2667 |
* |
|
2668 |
* @ingroup field_storage |
|
2628 | 2669 |
*/ |
2629 | 2670 |
function hook_field_storage_purge_field_instance($instance) { |
2630 | 2671 |
db_delete('my_module_field_instance_info') |
... | ... | |
2646 | 2687 |
* The (possibly deleted) field whose data is being purged. |
2647 | 2688 |
* @param $instance |
2648 | 2689 |
* The deleted field instance whose data is being purged. |
2690 |
* |
|
2691 |
* @ingroup field_storage |
|
2649 | 2692 |
*/ |
2650 | 2693 |
function hook_field_storage_purge($entity_type, $entity, $field, $instance) { |
2651 | 2694 |
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity); |
... | ... | |
2685 | 2728 |
* |
2686 | 2729 |
* @return |
2687 | 2730 |
* TRUE if the operation is allowed, and FALSE if the operation is denied. |
2731 |
* |
|
2732 |
* @ingroup field_types |
|
2688 | 2733 |
*/ |
2689 | 2734 |
function hook_field_access($op, $field, $entity_type, $entity, $account) { |
2690 | 2735 |
if ($field['field_name'] == 'field_of_interest' && $op == 'edit') { |
Formats disponibles : Unified diff
Update drupal 7.27 -> 7.28