Issue #1823306 by mkalkbrenner, p-neyens, webflo, swentel, zuuperman: Language code is missing from $context when hook_field_attach_view_alter() is invoked from field_view_field()
parent
ac0f69f1da
commit
9ddfc4697d
|
@ -1,6 +1,8 @@
|
|||
|
||||
Drupal 7.36, xxxx-xx-xx (development version)
|
||||
-----------------------
|
||||
- Fixed missing language code in hook_field_attach_view_alter() when it is
|
||||
invoked from field_view_field().
|
||||
- Stopped sending ETag and Last-Modified headers for uncached page requests,
|
||||
since they break caching for certain Varnish and Nginx configurations.
|
||||
- Changed the Simpletest module to allow PSR-4 test classes to be used in
|
||||
|
|
|
@ -894,6 +894,7 @@ function field_view_field($entity_type, $entity, $field_name, $display = array()
|
|||
'entity' => $entity,
|
||||
'view_mode' => '_custom',
|
||||
'display' => $display,
|
||||
'language' => $langcode,
|
||||
);
|
||||
drupal_alter('field_attach_view', $result, $context);
|
||||
|
||||
|
|
|
@ -2206,11 +2206,12 @@ class FieldDisplayAPITestCase extends FieldTestCase {
|
|||
'alter' => TRUE,
|
||||
),
|
||||
);
|
||||
$output = field_view_field('test_entity', $this->entity, $this->field_name, $display);
|
||||
$output = field_view_field('test_entity', $this->entity, $this->field_name, $display, LANGUAGE_NONE);
|
||||
$this->drupalSetContent(drupal_render($output));
|
||||
$setting = $display['settings']['test_formatter_setting_multiple'];
|
||||
$this->assertNoText($this->label, 'Label was not displayed.');
|
||||
$this->assertText('field_test_field_attach_view_alter', 'Alter fired, display passed.');
|
||||
$this->assertText('field language is ' . LANGUAGE_NONE, 'Language is placed onto the context.');
|
||||
$array = array();
|
||||
foreach ($this->values as $delta => $value) {
|
||||
$array[] = $delta . ':' . $value['value'];
|
||||
|
|
|
@ -220,6 +220,10 @@ function field_test_field_attach_view_alter(&$output, $context) {
|
|||
if (!empty($context['display']['settings']['alter'])) {
|
||||
$output['test_field'][] = array('#markup' => 'field_test_field_attach_view_alter');
|
||||
}
|
||||
|
||||
if (isset($output['test_field'])) {
|
||||
$output['test_field'][] = array('#markup' => 'field language is ' . $context['language']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue