HI @all,

I just recognized that the 'field' variable is lost in theme_link_formatter_link_default() function after upgrade to 7.x-1.1. Please give it a try and dump all variables in this function. You will see that 'field' is empty... but it is filled in link_field_formatter_view().

So, am I doing something wrong, or this this a bug?!

Thanx in advance & cheers

hctom

Comments

hctom’s picture

Any news on this topic?!

hctom’s picture

Status: Active » Needs review

Okay.. I found the problem. link_teme() does not implement the 'field' variable.

Add it like so:

/**
 * Implements hook_theme().
 */
function link_theme() {
  return array(
    'link_formatter_link_default' => array(
      'variables' => array('element' => NULL, 'field' => NULL),
    ),
    // ...
}

For anyone else encountering the same Problem: You may implement a hook_theme_registry_alter in a custom module to fix that like so:

/**
 * Implements hook_theme_registry_alter().
 */
function yourmodule_theme_registry_alter(&$theme_registry) {
  if (isset($theme_registry['link_formatter_link_default']) && isset($theme_registry['link_formatter_link_default']['variables'])) {
    if (empty($theme_registry['link_formatter_link_default']['variables']['field'])) {
      $theme_registry['link_formatter_link_default']['variables']['field'] = NULL;
    }
  }
}

Cheers

hctom

jcfiala’s picture

Updating this issue to remind me to look at it.

jcfiala’s picture

So, okay, theme_link_formatter_link_default doesn't get the field data. I'm unclear on why it should get the data?

hctom’s picture

... for better theming flexibility. Just imagine you would like to use some special markup for just one field on a specific entity bundle... With those variables passed, you will be able to do so.

jcfiala’s picture

Issue summary: View changes
Status: Needs review » Fixed

Alright, this should be fixed in dev now.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.