Function settingsForm overwrites parent::settingsForm #prefix and #suffix

Created on 19 November 2022, over 1 year ago
Updated 16 October 2023, 9 months ago

Problem/Motivation

Function settingsForm overwrites parent::settingsForm #prefix and #suffix

Proposed resolution

Prepend parent::settingsForm #prefix and append parent::settingsForm #suffix to custom Field Formatters #prefix and #suffix, e.g.,
replace:

      $form['#prefix'] = '<div id="field-formatter-ajax">';
      $form['#suffix'] = '</div>';

and

      $form['settings']['#prefix'] = '<div id="field-formatter-settings-ajax">';
      $form['settings']['#suffix'] = '</div>';

with:

    if (isset($form['#prefix'])) {
      $form['#prefix'] = '<div id="field-formatter-ajax">' . $form['#prefix'];
    }
    else {
      $form['#prefix'] = '<div id="field-formatter-ajax">';
    }
    if (isset($form['#suffix'])) {
      $form['#suffix'] = $form['#suffix'] . '</div>';
    }
    else {
      $form['#suffix'] = '</div>';
    }

and

      if (isset($form['settings']['#prefix'])) {
        $form['settings']['#prefix'] = '<div id="field-formatter-settings-ajax">' . $form['settings']['#prefix'];
      }
      else {
        $form['settings']['#prefix'] = '<div id="field-formatter-ajax">';
      }
      if (isset($form['settings']['#suffix'])) {
        $form['settings']['#suffix'] = $form['settings']['#suffix'] . '</div>';
      }
      else {
        $form['settings']['#suffix'] = '</div>';
      }

respectively.

Remaining tasks

Review and merge the patch.

User interface changes

None.

API changes

None.

Data model changes

Fix form #prefix and #suffix behavior by pretending and appending custom Field Formatters settings to parent form settings.

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΈπŸ‡¦Saudi Arabia martins.bruvelis Thuwal

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024