<?php

/**
 * @file
 * Functions to support theming in the sobki_theme_bootstrap_starterkit theme.
 */

declare(strict_types=1);

use Drupal\Core\Form\FormStateInterface;
use Drupal\sobki_theme_bootstrap_starterkit\HookHandler\FormSystemThemeSettingsAlter;
use Drupal\sobki_theme_bootstrap_starterkit\HookHandler\LibraryInfoAlter;

/**
 * Implements hook_form_FORM_ID_alter() for 'system_theme_settings'.
 */
function sobki_theme_bootstrap_starterkit_form_system_theme_settings_alter(array &$form, FormStateInterface $form_state): void {
  /** @var \Drupal\sobki_theme_bootstrap_starterkit\HookHandler\FormSystemThemeSettingsAlter $instance */
  $instance = \Drupal::service('class_resolver')
    ->getInstanceFromDefinition(FormSystemThemeSettingsAlter::class);
  $instance->alter($form, $form_state);
}

/**
 * Implements hook_library_info_alter().
 */
function sobki_theme_bootstrap_starterkit_library_info_alter(array &$libraries, string $extension): void {
  /** @var \Drupal\sobki_theme_bootstrap_starterkit\HookHandler\LibraryInfoAlter $instance */
  $instance = \Drupal::service('class_resolver')
    ->getInstanceFromDefinition(LibraryInfoAlter::class);
  $instance->alter($libraries, $extension);
}
