proboast-1.0.0-beta1/proboast.module

proboast.module
<?php

/**
 * @file
 * ProBoast module configurations.
 */

/**
 * Implements hook_theme().
 */
function proboast_theme() {
  return [
    'proboast_image' => [
      'variables' => [
        'widget' => NULL,
      ],
      'template' => 'proboast-image',
    ],
  ];
}

/**
 * Implements hook_preprocess_field().
 */
function proboast_preprocess_field(&$vars, $hook) {

  $config = \Drupal::service('config.factory')->getEditable('proboast.settings');

  $wrapper_class = $config->get('wrapper_class');
  $vars['attributes']['class'][] = $wrapper_class;

  foreach ($vars['items'] as &$item) {
    $image_class = $config->get('image_class');
    $item['attributes']->setAttribute('class', $image_class);
  }

}

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

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