Commit 2df4c837 authored by Atul Ghate's avatar Atul Ghate Committed by Neslee Canil Pinto
Browse files

Issue #3293566 by atul ghate, Indra patil: Drupal Coding Standard Issue

parent bfeeb926
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ class ConfigForm extends ConfigFormBase {
            $string .= '<li>@value' . $index . '</li>';
            $vars['@value' . $index] = $field;
          }
          $sring .= '</ul>';
          $string .= '</ul>';
          $list = new FormattableMarkup($string, $vars);
          $form_state->setErrorByName('enable_color_field', $this->t('The following fields are Color fields, so the Color Field cannot be disabled until they have been deleted: @field', ['@field' => $list]));
        }
@@ -140,7 +140,7 @@ class ConfigForm extends ConfigFormBase {
      ->set('enable_color_entity', (int) $form_state->getValue('enable_color_entity'))
      ->save();

    // @todo - Find a less nuclear option, ideally invalidating cache tags.
    // @todo Find a less nuclear option, ideally invalidating cache tags.
    drupal_flush_all_caches();

    parent::submitForm($form, $form_state);
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ class ColorapiRawHexDisplayFormatter extends ColorapiDisplayFormatterBase {

    $element['show_hash'] = [
      '#type' => 'checkbox',
      '#title' => t('Prefix color with hash (#) symbol'),
      '#title' => $this->t('Prefix color with hash (#) symbol'),
      '#default_value' => $this->getSetting('show_hash'),
    ];

+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ class ColorapiTextDisplayFormatter extends ColorapiDisplayFormatterBase {

    $element['show_hash'] = [
      '#type' => 'checkbox',
      '#title' => t('Prefix color with hash (#) symbol'),
      '#title' => $this->t('Prefix color with hash (#) symbol'),
      '#default_value' => $this->getSetting('show_hash'),
    ];

+2 −2
Original line number Diff line number Diff line
@@ -82,9 +82,9 @@ class ColorItem extends FieldItemBase implements ColorItemInterface {
   * {@inheritdoc}
   */
  public function setValue($values, $notify = TRUE) {
    $values['name'] = isset($values['name']) ? $values['name'] : '';
    $values['name'] = $values['name'] ?? '';
    $this->setName($values['name'], $notify);
    $color_string = isset($values['color']['hexadecimal']) ? $values['color']['hexadecimal'] : $values['color'];
    $color_string = $values['color']['hexadecimal'] ?? $values['color'];
    $this->setHexadecimal($color_string, $notify);
    $service = \Drupal::service('colorapi.service');
    $this->setRed($service->hexToRgb($color_string, 'red'), $notify);
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ abstract class ColorapiWidgetBase extends WidgetBase implements WidgetInterface

    $element['name'] = [
      '#type' => 'textfield',
      '#title' => t('Name'),
      '#title' => $this->t('Name'),
      '#default_value' => isset($items[$delta]) ? $items[$delta]->getColorName() : '',
      '#cardinality' => $this->fieldDefinition->getFieldStorageDefinition()->getCardinality(),
    ];