FieldReference::buildFieldFormRow() checks a local variable that has never been set

Created on 18 March 2024, 8 months ago
Updated 1 April 2024, 8 months ago

FieldReference::buildFieldFormRow() checks the value of $third_party_settings_form, which is never initialized, for example, in the following code.

      if ($settings_form || $third_party_settings_form) {
        $row['plugin']['#cell_attributes'] = ['colspan' => 3];
        $row['plugin']['settings_edit_form'] = [
          '#type' => 'container',
          '#attributes' => ['class' => ['field-plugin-settings-edit-form']],
          '#parents' => ['fields', "display_fields_$field_name", 'settings_edit_form'],
          'label' => ['#markup' => t('Plugin settings')],
          'settings' => $settings_form,
          // 'third_party_settings' => $third_party_settings_form,
          'actions' => [
            '#type' => 'actions',
            'save_settings' => $base_button + [
              '#type' => 'submit',
              '#button_type' => 'primary',
              '#name' => "display_fields_{$field_name}_plugin_settings_update",
              '#value' => t('Update'),
              '#op' => 'update',
            ],
            'cancel_settings' => $base_button + [
              '#type' => 'submit',
              '#name' => "display_fields_{$field_name}_plugin_settings_cancel",
              '#value' => t('Cancel'),
              '#op' => 'cancel',
              // Do not check errors for the Cancel button, but make sure we
              // get the value of the plugin type select.
              '#limit_validation_errors' => [['fields', "display_fields_$field_name", 'type']],
            ],
          ],
        ];
        $row['#attributes']['class'][] = 'field-plugin-settings-editing';
      }
    }

Since there is not a class method that could initialize that variable, that variable should not be used.

🐛 Bug report
Status

Fixed

Version

9.1

Component

Code

Created by

🇮🇹Italy apaderno Brescia, 🇮🇹

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024