Skip to content
Snippets Groups Projects
Verified Commit 5c30729a authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3422845 by scott_euser, smustgrave: Improve the relationships documentation in views.api.php

parent 29f289f3
No related branches found
No related tags found
No related merge requests found
......@@ -313,6 +313,8 @@ function hook_views_data() {
'id' => 'standard',
// Default label for relationship in the UI.
'label' => t('Example node'),
// Description shown within the add relationship handler in the UI.
'help' => t('Relationship between the node and node field data'),
],
];
......@@ -495,8 +497,8 @@ function hook_views_data_alter(array &$data) {
// In Views data definitions, each field can have only one relationship. So
// rather than adding this relationship directly to the $data['foo']['fid']
// field entry, which could overwrite an existing relationship, we define
// a dummy field key to handle the relationship.
$data['foo']['unique_dummy_name'] = [
// a placeholder field key to handle the relationship.
$data['foo']['unique_placeholder_name'] = [
'title' => t('Title seen while adding relationship'),
'help' => t('More information about the relationship'),
......@@ -506,11 +508,13 @@ function hook_views_data_alter(array &$data) {
// Database field name in example_table for the join.
'base field' => 'eid',
// Real database field name in foo for the join, to override
// 'unique_dummy_name'.
// 'unique_placeholder_name'.
'field' => 'fid',
// ID of relationship handler plugin to use.
'id' => 'standard',
'label' => t('Default label for relationship'),
// Description shown within the add relationship handler in the UI.
'help' => t('Description of the placeholder field relationship'),
],
];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment