Advertisement
Guest User

Untitled

a guest
May 29th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. /**
  2. * Implements hook_field_formatter_info().
  3. */
  4. function ft_continent_field_formatter_info() {
  5. return array(
  6. 'anchor_title' => array(
  7. 'label' => t('Anchor title'),
  8. 'field types' => array('text'),
  9. ),
  10. );
  11. }
  12.  
  13. /**
  14. * Implements hook_field_formatter_view().
  15. */
  16. function ft_continent_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  17. $element = array();
  18.  
  19. switch ($display['type']) {
  20. // Formatter fo anchor title.
  21. case 'anchor_title':
  22. foreach ($items as $delta => $item) {
  23. $id = drupal_html_id($item['value']);
  24. $element[$delta] = array('#markup' => '<h3 id="' . $id . '">'. strip_tags($item['value'] . '</h3>'));
  25. }
  26. break;
  27. }
  28.  
  29. return $element;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement