public static function MarkerIconService::validateIconImageStatus in Geofield Map 8.2
Validates the Icon Image statuses.
Parameters
array $element: The form element.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- src/
Services/ MarkerIconService.php, line 250
Class
- MarkerIconService
- Provides an Icon Managed File Service.
Namespace
Drupal\geofield_map\ServicesCode
public static function validateIconImageStatus(array $element, FormStateInterface $form_state) {
$clicked_button = end($form_state
->getTriggeringElement()['#parents']);
if (!empty($element['#value']['fids'][0])) {
/* @var \Drupal\file\Entity\file $file */
$file = File::load($element['#value']['fids'][0]);
if (in_array($clicked_button, [
'save_settings',
'submit',
])) {
$file
->setPermanent();
self::fileSave($file);
}
if ($clicked_button == 'remove_button') {
$file
->setTemporary();
self::fileSave($file);
}
}
}