You are here

function webform_image_select_test_webform_image_select_images_alter in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_image_select/tests/modules/webform_image_select_test/webform_image_select_test.module \webform_image_select_test_webform_image_select_images_alter()

Implements hook_webform_image_select_images_alter().

File

modules/webform_image_select/tests/modules/webform_image_select_test/webform_image_select_test.module, line 22
Support module for webform that provides image select element working examples.

Code

function webform_image_select_test_webform_image_select_images_alter(array &$images, array &$element, $id) {
  if ($id === 'animals' && ($bears = WebformImageSelectImages::load('bears'))) {
    $images += $bears
      ->getImages();

    // Set the default value to one of the added images.
    $element['#default_value'] = 'kitten_1';
  }
}