<?php

declare(strict_types=1);

namespace Drupal\sobki_ui_suite\HookHandler;

/**
 * Alter pattern definition.
 */
class UiPatternsInfoAlter {

  /**
   * Alter pattern definitions.
   *
   * @param array $definitions
   *   An associative array of pattern definitions.
   */
  public function alter(array &$definitions): void {
    if (isset($definitions['yaml:button'])) {
      $additional = $definitions['yaml:button']->getAdditional();
      $additional['allow_variant_token'] = TRUE;
      $definitions['yaml:button']->setAdditional($additional);
    }

    if (isset($definitions['yaml:progress'])) {
      $additional = $definitions['yaml:progress']->getAdditional();
      $additional['allow_variant_token'] = TRUE;
      $definitions['yaml:progress']->setAdditional($additional);
    }
  }

}
