function hook_farm_ui_entity_views in farmOS 7
Attach Views to an entity page.
Parameters
$entity_type: The entity type. Currently supports: 'farm_asset' or 'taxonomy_term'.
$bundle: The entity bundle.
$entity: The loaded entity object.
Return value
array Returns an array of View to attach to taxonomy term pages. Each element in the array can either be the name of a View, or an array of options, including: 'name' - the machine name of the View 'display' - which display of the View should be used 'arg' - which argument the term id should be passed to in the View (this is useful if the View has more than one contextual filter) 'group' - the group to put the View in (options are: assets, logs, other) 'weight' - the weight of the View in the entity page (this is useful for changing the order of Views) 'always' - always display, even if there are no View results (default is FALSE)
Related topics
9 functions implement hook_farm_ui_entity_views()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- farm_asset_children_farm_ui_entity_views in modules/
farm/ farm_asset/ farm_asset_children/ farm_asset_children.module - Implements hook_farm_ui_entity_views().
- farm_crop_farm_ui_entity_views in modules/
farm/ farm_crop/ farm_crop.module - Implements hook_farm_ui_entity_views().
- farm_equipment_field_farm_ui_entity_views in modules/
farm/ farm_equipment/ farm_equipment_field/ farm_equipment_field.module - Implements hook_farm_ui_entity_views().
- farm_group_farm_ui_entity_views in modules/
farm/ farm_group/ farm_group.module - Implements hook_farm_ui_entity_views().
- farm_inventory_farm_ui_entity_views in modules/
farm/ farm_inventory/ farm_inventory.module - Implements hook_farm_ui_entity_views().
1 invocation of hook_farm_ui_entity_views()
- farm_ui_entity_views in modules/
farm/ farm_ui/ farm_ui.entity_views.inc - Build a renderable array of Views to add to a farmOS entity.
File
- modules/
farm/ farm_ui/ farm_ui.api.php, line 201 - Hooks provided by farm_ui.
Code
function hook_farm_ui_entity_views($entity_type, $bundle, $entity) {
// If the entity is not a planting asset, bail.
if (!($entity_type == 'farm_asset' && $bundle == 'planting')) {
return array();
}
// Return a list of Views to include on Plantings.
return array(
// Example 1: simple View machine name.
'farm_activity',
// Example 2: explicitly set details like display, argument position,
// and weight.
array(
'name' => 'farm_log_input',
'display' => 'block',
'arg' => 2,
'group' => 'logs',
'weight' => 10,
'always' => TRUE,
),
);
}