Commit 9a53a21b authored by alexpott's avatar alexpott

Issue #1823306 by webflo, mkalkbrenner, zuuperman, swentel: Fixed Missing...

Issue #1823306 by webflo, mkalkbrenner, zuuperman, swentel: Fixed Missing langcode in  in hook_field_attach_view_alter().
parent ed131e7c
......@@ -1085,7 +1085,7 @@ function hook_field_attach_purge(\Drupal\Core\Entity\EntityInterface $entity, $f
* $display_options argument and the view_mode element is set to '_custom'.
* See field_view_field() for more information on what its $display_options
* argument contains.
* - language: The language code used for rendering.
* - langcode: The language code used for rendering.
*/
function hook_field_attach_view_alter(&$output, $context) {
// Append RDF term mappings on displayed taxonomy links.
......
......@@ -866,6 +866,7 @@ function field_view_field(EntityInterface $entity, $field_name, $display_options
'entity' => $entity,
'view_mode' => $view_mode,
'display_options' => $display_options,
'langcode' => $display_langcode,
);
drupal_alter('field_attach_view', $result, $context);
......
......@@ -99,6 +99,7 @@ function testFieldViewField() {
$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_NOT_SPECIFIED, 'Language is placed onto the context.');
$array = array();
foreach ($this->values as $delta => $value) {
$array[] = $delta . ':' . $value['value'];
......
......@@ -193,6 +193,10 @@ function field_test_field_attach_view_alter(&$output, $context) {
if (!empty($context['display_options']['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['langcode']);
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment