Add field context to theme variables array when viewing a field formatted with simple_gmap

Created on 8 May 2014, almost 11 years ago
Updated 23 January 2025, 3 months ago

It would be handy if the $field, $instance, $entity and $entity_type variables were passed into the the theme function along with the default theme variables. This would provide a little more context if someone is overriding the template file and/or (pre)processing the theme hook.

In my case I want to add a theme suggestion that is something like the following:

function MYTHEME_preprocess_simple_gmap_output(&$vars,$hook) {
  if (!empty($vars['instance']['field_name'])) {
    $vars['theme_hook_suggestions'][] = 'simple_gmap_output__' . $vars['instance']['field_name'];
  }
}

so that I can override the template file per field.

btw @jhodgdon, I read your very good follow blog 'The case for a small Drupal shop contributing to Drupal' this morning. I agree 100%.

✨ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada acrazyanimal

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024