Undefined array key in linkchecker_form_field_ui_field_edit_form_alter

Created on 16 May 2023, about 1 year ago
Updated 11 October 2023, 9 months ago

Problem/Motivation

  $linkchecker_excludes = variable_get('linkchecker_exclude');
  $form['field']['linkchecker_exclude'] = array (
    '#type' => 'checkbox',
    '#title' => t('Exclude field from Link Checker scans'),
    '#description' => t('Force Link Checker to ignore this field when scanning content for broken links.'),
    '#default_value' => $linkchecker_excludes[$form['#field']['field_name']] ? $linkchecker_excludes[$form['#field']['field_name']] : 0,
  );

If the field name is not in the excludes array, you get an "Undefined array key" warning.

Steps to reproduce

Visit /admin/structure/taxonomy/TAXONOMY_NAME/fields/FIELD_NAME for a field that is not excluded from linkchecker.

Proposed resolution

This fixes the issue.

'#default_value' => isset($linkchecker_excludes[$form['#field']['field_name']]) ? $linkchecker_excludes[$form['#field']['field_name']] : 0,

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024