protected function InsertFileWidgetUtility::aggregateVariables in Insert 8
Parameters
string $styleName:
array $element:
string $fieldType:
Return value
array
2 calls to InsertFileWidgetUtility::aggregateVariables()
- InsertFileWidgetUtility::process in src/
Utility/ InsertFileWidgetUtility.php - Form API callback: Processes a file field element.
- InsertImageWidgetUtility::aggregateVariables in src/
Utility/ InsertImageWidgetUtility.php - @inheritdoc
1 method overrides InsertFileWidgetUtility::aggregateVariables()
- InsertImageWidgetUtility::aggregateVariables in src/
Utility/ InsertImageWidgetUtility.php - @inheritdoc
File
- src/
Utility/ InsertFileWidgetUtility.php, line 408
Class
Namespace
Drupal\insert\UtilityCode
protected function aggregateVariables($styleName, $element, $fieldType) {
if (count($element['#value']['fids']) === 0) {
return [];
}
$config = \Drupal::config('insert.config');
$file = File::load($element['#value']['fids'][0]);
$absolute = isset($element['#insert_absolute']) ? !!$element['#insert_absolute'] : FALSE;
$vars = [
'item' => $element['#value'],
'style_name' => $styleName,
'element' => $element,
'field_type' => $fieldType,
'file' => $file,
'entity_type' => $file
->getEntityTypeId(),
'uuid' => $file
->uuid(),
'class' => $config
->get('css_classes.' . $fieldType),
'url' => static::aggregateUrl($file
->getFileUri(), $absolute),
];
return $vars;
}