Prevent fatal error while loading authors data
This commit is contained in:
parent
3ddef4a97f
commit
fa27dc1a4d
1 changed files with 2 additions and 2 deletions
|
@ -129,8 +129,8 @@ function agarica_languague_switch_link() {
|
||||||
function agarica_preprocess_field__field_title(&$variables) {
|
function agarica_preprocess_field__field_title(&$variables) {
|
||||||
$parentEntity = $variables['element']['#object']->getParentEntity();
|
$parentEntity = $variables['element']['#object']->getParentEntity();
|
||||||
if ($parentEntity instanceof EntityInterface && $parentEntity->getEntityTypeId() === 'node') {
|
if ($parentEntity instanceof EntityInterface && $parentEntity->getEntityTypeId() === 'node') {
|
||||||
if ($parentEntity->get('field_authors')) {
|
if (isset($parentEntity->getFields()['field_authors'])) {
|
||||||
$field_authors = $parentEntity->get('field_authors');
|
$field_authors = $parentEntity->getFields()['field_authors'];
|
||||||
$authors = '';
|
$authors = '';
|
||||||
$date = $parentEntity->getCreatedTime();
|
$date = $parentEntity->getCreatedTime();
|
||||||
foreach ($field_authors as $author) {
|
foreach ($field_authors as $author) {
|
||||||
|
|
Loading…
Reference in a new issue