Alterable list items with hook_shs_default_formatter_list_alter() function

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nevergone created an issue. See original summary.

nevergone’s picture

Status: Active » Needs review
FileSize
1.55 KB
stBorchert’s picture

Hm, I'm not sure if this is really necessary ...
You can simply do this with the following code:

<?php
function MYMODULE_field_formatter_info_alter(&$info) {
  $info['shs_default']['module'] = 'MYMODULE';
}

function MYMODULE_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  // Call to original field formatter.
  $element = shs_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display);
  // Alter the element.
  foreach (element_children($element) as $delta) {
    // ...
  }
}
?>

Additionally the other field_formatter-hooks need to be implemented for this module (simply calling the equivalent of SHS) to make this work completely.

So I don't see a point in adding another hook here ...

stBorchert’s picture

Status: Needs review » Closed (works as designed)