Problem/Motivation

After installing I am getting the following:

Notice: Undefined index: #layout_builder_title_link in layout_builder_title_link_preprocess_block() (line 79 of /home/sites/sitename/public_html/modules/contrib/layout_builder_title_link/layout_builder_title_link.module). => Array

Steps to reproduce

Activate the module with errors to screen.

Proposed resolution

Define the index

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#5 3183017-4.patch866 bytesmohammad-fayoumi

Comments

Christopher Riley created an issue. See original summary.

Christopher Riley’s picture

I changed the line from the following:

$blockTitleURL = $variables['elements']['#layout_builder_title_link'];

to be:

$blockTitleURL = isset($variables['elements']['#layout_builder_title_link']) ? $variables['elements']['#layout_builder_title_link'] : '';

And I no longer have the issue. What does everyone think?

mohammad-fayoumi’s picture

Christopher Riley Thanks for reporting this issue.

I think the best practice to solve this undefined index by check if the index is set the define this variable $blockTitleURL like this

if (isset($variables['elements']['#layout_builder_title_link']) && !empty($variables['elements']['#layout_builder_title_link'])) {
    $blockTitleURL = $variables['elements']['#layout_builder_title_link'];
}

I'll put a patch for that.

mohammad-fayoumi’s picture

Version: 1.0.0-beta1 » 1.0.0-beta2
Assigned: Unassigned » mohammad-fayoumi
mohammad-fayoumi’s picture

StatusFileSize
new866 bytes

Here is the patch to solve Notice: Undefined index: #layout_builder_title_link

mohammad-fayoumi’s picture

Status: Active » Needs review

  • Mohammad Fayoumi committed ac16d6c on 1.0.x
    Issue #3183017 by Mohammad Fayoumi, Christopher Riley: Undefined Index
    
mohammad-fayoumi’s picture

Status: Needs review » Reviewed & tested by the community
mohammad-fayoumi’s picture

Issue tags: +undefined index

Fixed in the new release 1.0.0-beta3

mohammad-fayoumi’s picture

Version: 1.0.0-beta2 » 1.0.0-beta3
mohammad-fayoumi’s picture

Assigned: mohammad-fayoumi » Unassigned
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.