Calling abstract method FormInterface::submitForm()

Created on 10 October 2023, 9 months 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

Needs review

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

Comments & Activities

Production build 0.69.0 2024