Skip to content

Commit

Permalink
handle non-array in preprocess hook
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Nov 29, 2023
1 parent 8f0dfa9 commit 399a2d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docroot/modules/humsci/hs_layouts/hs_layouts.module
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function _hs_layouts_field_has_title($field) {
* Implements hook_preprocess_HOOK().
*/
function hs_layouts_preprocess_pattern_vertical_card(&$variables) {
if (isset($variables['title']['#field'])) {
if (is_array($variables['title']) && isset($variables['title']['#field'])) {
$field = $variables['title']['#field'];
$variables['title_has_heading'] = _hs_layouts_field_has_title($field);
}
Expand All @@ -98,7 +98,7 @@ function hs_layouts_preprocess_pattern_vertical_card(&$variables) {
* Implements hook_preprocess_HOOK().
*/
function hs_layouts_preprocess_pattern_horizontal_card(&$variables) {
if (isset($variables['title']['#field'])) {
if (is_array($variables['title']) && isset($variables['title']['#field'])) {
$field = $variables['title']['#field'];
$variables['title_has_heading'] = _hs_layouts_field_has_title($field);
}
Expand All @@ -108,7 +108,7 @@ function hs_layouts_preprocess_pattern_horizontal_card(&$variables) {
* Implements hook_preprocess_HOOK().
*/
function hs_layouts_preprocess_pattern_vertical_link_card(&$variables) {
if (isset($variables['title']['#field'])) {
if (is_array($variables['title']) && isset($variables['title']['#field'])) {
$field = $variables['title']['#field'];
$variables['title_has_heading'] = _hs_layouts_field_has_title($field);
}
Expand Down

0 comments on commit 399a2d3

Please sign in to comment.