Add authors and date to paragraph title template rather than field template
Ref #239
This commit is contained in:
parent
31a43c1890
commit
eeadf9a0b6
1 changed files with 4 additions and 9 deletions
|
@ -142,13 +142,8 @@ function agarica_languague_switch_link() {
|
||||||
/**
|
/**
|
||||||
* Implements hook_preprocess_HOOK() for field__field_title template.
|
* Implements hook_preprocess_HOOK() for field__field_title template.
|
||||||
*/
|
*/
|
||||||
function agarica_preprocess_field__field_title(&$variables) {
|
function agarica_preprocess_paragraph__title(&$variables) {
|
||||||
$parentEntity = $variables['element']['#object']->getParentEntity();
|
$field_title = $variables['content']['field_title']['#object'];
|
||||||
if ($parentEntity instanceof EntityInterface && $parentEntity->getEntityTypeId() === 'node') {
|
$variables['authors'] = $field_title->authors_html;
|
||||||
if (isset($parentEntity->getFields()['field_authors'])) {
|
$variables['date'] = $field_title->date_html;
|
||||||
|
|
||||||
$variables['authors'] = $variables['element']['#object']->authors_html;
|
|
||||||
$variables['date'] = $variables['element']['#object']->date_html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue