Calling abstract method FormInterface::submitForm()

Created on 10 October 2023, about 1 year ago

Problem/Motivation

The class Drupal\conditional_fields\Form\ConditionalFieldForm extends FormBase and has a method submitForm() which calls the parent::submitForm, but the parent class is abstract so this is not permitted.

  public function submitForm(array &$form, FormStateInterface $form_state) {
    $table = $form_state->getValue('table');
    if (empty($table['add_new_dependency']) || !is_array($table['add_new_dependency'])) {
      parent::submitForm($form, $form_state);
    }

Proposed resolution

Not sure what is expected to happen when the if statement returns a TRUE value, but as nothing will actually happen, the whole if statement should probably be removed.

Remaining tasks

Note also that there are two calls to "parent::validateForm() which exists but is an empty function, so these calls should probably also be removed as they achieve nothing.

๐Ÿ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand jlscott

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