crossword-8.x-1.x-dev/modules/crossword_pseudofields/crossword_pseudofields.install

modules/crossword_pseudofields/crossword_pseudofields.install
<?php

/**
 * @file
 * Update hooks for crossword pseudofields.
 */

/**
 * Update pseudofields with new button schema: Issue #3173233.
 */
function crossword_pseudofields_update_8001() {
  $config = \Drupal::service('config.factory')->getEditable('crossword_pseudofields.settings');
  $buttons = [
    'cheat' => 'Cheat',
    'solution' => 'Solution',
    'clear' => 'Clear',
    'undo' => 'Undo',
    'redo' => 'Redo',
  ];
  $button_settings = $config->get('buttons')['buttons'];
  foreach ($button_settings as $key => $val) {
    $button_settings[$key] = [
      'show' => $val != FALSE,
      'input_label' => $buttons[$key],
    ];
  }
  $config->set('buttons.buttons', $button_settings);
  $config->set('rebus.input_label', 'Rebus entry active');
  $config->set('errors.input_label', 'Show Errors');
  $config->set('references.input_label', 'Show References');
  $config->save();
}

/**
 * Update pseudofields with default confirmation text: Issue #3190407.
 */
function crossword_pseudofields_update_8002() {
  $config = \Drupal::service('config.factory')->getEditable('crossword_pseudofields.settings');
  $button_settings = $config->get('buttons')['buttons'];
  if (isset($button_settings['clear']) && !isset($button_settings['clear']['confirm'])) {
    $button_settings['clear']['confirm'] = 'Do you really want to clear? This action cannot be undone.';
  }
  if (isset($button_settings['solution']) && !isset($button_settings['solution']['confirm'])) {
    $button_settings['solution']['confirm'] = 'Do you really want to give up?';
  }
  $config->set('buttons.buttons', $button_settings);
  $config->save();
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc