71 lines
1.8 KiB
PHP
71 lines
1.8 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Hooks provided by farm_taxonomy.
|
|
*
|
|
* This file contains no working PHP code; it exists to provide additional
|
|
* documentation for doxygen as well as to document hooks in the standard
|
|
* Drupal manner.
|
|
*/
|
|
|
|
/**
|
|
* @defgroup farm_taxonomy Farm taxonomy module integrations.
|
|
*
|
|
* Module integrations with the farm_taxonomy module.
|
|
*/
|
|
|
|
/**
|
|
* @defgroup farm_taxonomy_hooks Farm taxonomy's hooks
|
|
* @{
|
|
* Hooks that can be implemented by other modules in order to extend
|
|
* farm_taxonomy.
|
|
*/
|
|
|
|
/**
|
|
* Attach Views to taxonomy term pages.
|
|
*
|
|
* @param object $term
|
|
* The taxonomy term entity.
|
|
*
|
|
* @return 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)
|
|
* 'weight' - the weight of the View in the taxonomy page
|
|
* (this is useful for changing the order of Views)
|
|
* 'always' - always display, even if there are no View results
|
|
* (default is FALSE)
|
|
*/
|
|
function hook_farm_taxonomy_term_view_views($term) {
|
|
|
|
// If the term is not a crop, bail.
|
|
if ($term->vocabulary_machine_name != 'farm_crops') {
|
|
return array();
|
|
}
|
|
|
|
// Return a list of Views to include on Crops.
|
|
return array(
|
|
|
|
// Example 1: simple View machine name.
|
|
'farm_planting',
|
|
|
|
// Example 2: explicitly set details like display, argument position, weight.
|
|
array(
|
|
'name' => 'farm_log_input',
|
|
'display' => 'block',
|
|
'arg' => 2,
|
|
'weight' => 10,
|
|
'always' => TRUE,
|
|
),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @}
|
|
*/
|