Projet

Général

Profil

Révision 6eb8d15f

Ajouté par Assos Assos il y a presque 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/views.api.php
513 513
  // Note that the $data array is not returned – it is modified by reference.
514 514
}
515 515

  
516
/**
517
 * Override the default data for a Field API field.
518
 *
519
 * Field module's implementation of hook_views_data() invokes this for each
520
 * field in the module that defines the field type (as declared in the field
521
 * array). It is not invoked in other modules.
522
 *
523
 * If no hook implementation exists, hook_views_data() falls back to
524
 * field_views_field_default_views_data().
525
 *
526
 * @see field_views_data()
527
 * @see hook_field_views_data_alter()
528
 * @see hook_field_views_data_views_data_alter()
529
 *
530
 * @param $field
531
 *  A field definition array, as returned by field_info_fields().
532
 *
533
 * @return
534
 *  An array of views data, in the same format as the return value of
535
 *  hook_views_data().
536
 */
537
function hook_field_views_data($field) {
538

  
539
}
540

  
541
/**
542
 * Alter the views data for a single Field API field.
543
 *
544
 * This is called even if there is no hook_field_views_data() implementation for
545
 * the field, and therefore may be used to alter the default data that
546
 * field_views_field_default_views_data() supplies for the field.
547
 *
548
 * @param $result
549
 *  An array of views table data provided for a single field. This has the same
550
 *  format as the return value of hook_views_data().
551
 * @param $field
552
 *  A field definition array, as returned by field_info_fields().
553
 * @param $module
554
 *  The module that defines the field type.
555
 *
556
 * @see field_views_data()
557
 * @see hook_field_views_data()
558
 * @see hook_field_views_data_views_data_alter()
559
 */
560
function hook_field_views_data_alter(&$result, $field, $module) {
561

  
562
}
563

  
564
/**
565
 * Alter the views data on a per field basis.
566
 *
567
 * Field module's implementation of hook_views_data_alter() invokes this for
568
 * each field in the module that defines the field type (as declared in the
569
 * field array). It is not invoked in other modules.
570
 *
571
 * Unlike hook_field_views_data_alter(), this operates on the whole of the views
572
 * data. This allows a field module to add data that concerns its fields to
573
 * other tables, which would not yet be defined at the point when
574
 * hook_field_views_data() and hook_field_views_data_alter() are invoked. For
575
 * example, entityreference adds reverse relationships on the tables for the
576
 * entities which are referenced by entityreference fields.
577
 *
578
 * (Note: this is weirdly named so as not to conflict with
579
 * hook_field_views_data_alter().)
580
 *
581
 * @see hook_field_views_data()
582
 * @see hook_field_views_data_alter()
583
 * @see field_views_data_alter()
584
 */
585
function hook_field_views_data_views_data_alter(&$data, $field) {
586
  $field_name = $field['field_name'];
587
  $data_key = 'field_data_' . $field_name;
588
  // Views data for this field is in $data[$data_key]
589
}
516 590

  
517 591
/**
518 592
 * Describes plugins defined by the module.

Formats disponibles : Unified diff