You are here

function hook_shs_term_data_alter in Simple hierarchical select 8

Same name and namespace in other branches
  1. 2.0.x shs.api.php \hook_shs_term_data_alter()

Alter the <strong>uncached</strong> term data for all bundles and fields.

Parameters

array $data: Array with term data used for a single SHS widget.

array $context: Associativ array containing information about the current context:

  • bundle: Name of vocabulary the data is fetched from
  • identifier: Identifier of field to fetch the data for
  • parent: Term Id of parent term (0 for first level)

See also

ShsController::getTermData()

File

./shs.api.php, line 92
Hooks for the shs module.

Code

function hook_shs_term_data_alter(array &$data, array $context) {

  // Prepend each term name (rendered option label) with dots.
  array_walk($data, function (&$term, &$key) {
    $term->name = $term->name . ' ...';
  });
}