You are here

function date_recur_update_8205 in Recurring Dates Field 3.x

Same name and namespace in other branches
  1. 8.2 date_recur.install \date_recur_update_8205()
  2. 3.0.x date_recur.install \date_recur_update_8205()
  3. 3.1.x date_recur.install \date_recur_update_8205()

Add a default interpreter.

File

./date_recur.install, line 271

Code

function date_recur_update_8205(&$sandbox) : void {
  if (DateFormat::load('long') && !DateRecurInterpreter::load('default_interpreter')) {
    $configFactory = \Drupal::configFactory();
    $interpreter = $configFactory
      ->getEditable('date_recur.interpreter.default_interpreter');
    $interpreter
      ->setData([
      'id' => 'default_interpreter',
      'label' => 'Default interpreter',
      'plugin' => 'rl',
      'settings' => [
        'show_start_date' => TRUE,
        'show_until' => TRUE,
        'date_format' => 'long',
        'show_infinite' => TRUE,
      ],
    ]);
    $interpreter
      ->save(TRUE);
  }
}