public function WebformImageSelectImages::getImages in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_image_select/src/Entity/WebformImageSelectImages.php \Drupal\webform_image_select\Entity\WebformImageSelectImages::getImages()
Get images (YAML) as an associative array.
Return value
array|bool Images as an associative array. Returns FALSE if images YAML is invalid.
Overrides WebformImageSelectImagesInterface::getImages
File
- modules/
webform_image_select/ src/ Entity/ WebformImageSelectImages.php, line 108
Class
- WebformImageSelectImages
- Defines the webform image select images entity.
Namespace
Drupal\webform_image_select\EntityCode
public function getImages() {
if (!isset($this->imagesDecoded)) {
try {
$options = WebformYaml::decode($this->images);
// Since YAML supports simple values.
$options = is_array($options) ? $options : [];
} catch (\Exception $exception) {
$link = $this
->toLink($this
->t('Edit'), 'edit-form')
->toString();
\Drupal::logger('webform_image_select')
->notice('%title images are not valid. @message', [
'%title' => $this
->label(),
'@message' => $exception
->getMessage(),
'link' => $link,
]);
$options = FALSE;
}
$this->imagesDecoded = $options;
}
return $this->imagesDecoded;
}