Error adding font color

Created on 20 August 2024, 4 months ago

Problem/Motivation

Warning: Undefined array key "type" in docroot/modules/contrib/ckeditor5_plugin_pack/modules/ckeditor5_plugin_pack_font/src/Plugin/CKEditor5Plugin/FontColor.php on line 83
Warning: foreach() argument must be of type array|object, null given in docroot/core/lib/Drupal/Core/Render/Element/Checkboxes.php on line 113

Proposed resolution

Existing code:

      $form['custom_colors_wrapper'][$colorId]['type'] = [
        '#type' => 'checkboxes',
        '#title' => $this->t('Type'),
        '#options' => [
          'font' => $this->t('Font Color'),
          'background' => $this->t('Background Color'),
        ],
        '#default_value' => $option['type'],
        '#ajax' => FALSE,
      ];

Change to:

      $form['custom_colors_wrapper'][$colorId]['type'] = [
        '#type' => 'checkboxes',
        '#title' => $this->t('Type'),
        '#options' => [
          'font' => $this->t('Font Color'),
          'background' => $this->t('Background Color'),
        ],
        '#default_value' => $option['type'] ?? [],
        '#ajax' => FALSE,
      ];
πŸ› Bug report
Status

Active

Version

1.2

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada michael.barlow@mirumagency.com

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