You are here

public static function Blazy::preprocessField in Blazy 8.2

Overrides variables for field.html.twig templates.

1 call to Blazy::preprocessField()
blazy_preprocess_field in ./blazy.module
Implements hook_preprocess_field().

File

src/Blazy.php, line 416

Class

Blazy
Provides common blazy utility static methods.

Namespace

Drupal\blazy

Code

public static function preprocessField(array &$variables) {
  $element =& $variables['element'];
  $settings = empty($element['#blazy']) ? [] : $element['#blazy'];

  // 1. Hence Blazy is not the formatter, lacks of settings.
  if (!empty($element['#third_party_settings']['blazy']['blazy'])) {
    BlazyAlter::thirdPartyPreprocessField($variables);
  }

  // 2. Hence Blazy is the formatter, has its settings.
  if (empty($settings['_grid'])) {
    self::containerAttributes($variables['attributes'], $settings);
  }
}