Remove authoring details from title paragraph, to be displayed on every node with authors

This commit is contained in:
Keegan Rankin 2023-08-30 13:30:17 -07:00
parent bb9f5548f2
commit e9a3784f41
2 changed files with 1 additions and 26 deletions

View file

@ -18,22 +18,6 @@ function agarica_preprocess_node(&$variables) {
$allowed_regions = ['secondary_menu'];
agarica_add_regions_to_node($allowed_regions, $variables);
}
$field_body_paragraph = $variables['elements']['field_body_paragraph'] ?? NULL;
if (isset($field_body_paragraph)) {
$max_key = max(array_map('intval', array_keys($field_body_paragraph)));
for ($i = 0; $i <= $max_key; $i++) {
if ($field_body_paragraph[$i]['#paragraph']->getType() === 'title') {
$renderer = \Drupal::service('renderer');
$authors_html = $renderer->render($variables['content']['field_authors']);
$date_html = $variables['date'];
$field_body_paragraph[$i]['#paragraph']->authors_html = $authors_html;
$field_body_paragraph[$i]['#paragraph']->date_html = $date_html;
}
}
}
}
/**
@ -137,12 +121,3 @@ function agarica_languague_switch_link() {
return $links_render_array;
}
/**
* Implements hook_preprocess_HOOK() for field__field_title template.
*/
function agarica_preprocess_paragraph__title(&$variables) {
$field_title = $variables['content']['field_title']['#object'];
$variables['authors'] = $field_title->authors_html;
$variables['date'] = $field_title->date_html;
}

@ -1 +1 @@
Subproject commit be59bfdb2c1479bc06106b3e6944c9e9062df1b3
Subproject commit 5c64104e87d2d77a926edfcd13ddbf1c3f022815