tarte_au_citron-1.0.0-beta1/tarte_au_citron.api.php

tarte_au_citron.api.php
<?php

/**
 * @file
 * Hooks related to tarte_au_citron API.
 */

/**
 * @addtogroup hooks
 * @{
 */

use Drupal\Core\Config\Config;
use Drupal\Core\Form\FormStateInterface;
use Drupal\tarte_au_citron\ServicePluginInterface;

/**
 * Alter the render array to add library and settings needed.
 *
 * @param array $attachments
 *   The render array.
 * @param \Drupal\tarte_au_citron\ServicePluginInterface $service
 *   The service.
 */
function hook_tarte_au_citron_SERVICE_ID_alter(array &$attachments, ServicePluginInterface $service): void {
  $attachments['#attached']['library'][] = 'my library';
  $attachments['#attached']['drupalSettings']['mymodule'] = ['key' => 'value'];
}

/**
 * Alter the js config.
 *
 * @param array $data
 *   The texts.
 */
function hook_tarte_au_citron_config_alter(array &$data): void {
  $data['my_text_id'] = [
    'type' => 'label',
    'default_value' => 'my_text_value',
  ];
}

/**
 * Alter the text's config.
 *
 * @param array $data
 *   The texts.
 */
function hook_tarte_au_citron_texts_config_alter(array &$data): void {
  $data['my_text_id'] = [
    'type' => 'label',
    'default_value' => 'my_text_value',
  ];
}

/**
 * @} End of "addtogroup hooks".
 */

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

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