You are here

public static function ImageStyles::stringToBool in Consumer Image Styles 8.3

Same name and namespace in other branches
  1. 4.x src/Plugin/jsonapi/FieldEnhancer/ImageStyles.php \Drupal\consumer_image_styles\Plugin\jsonapi\FieldEnhancer\ImageStyles::stringToBool()

Transforms the string from the checkbox into an actual boolean.

File

src/Plugin/jsonapi/FieldEnhancer/ImageStyles.php, line 255

Class

ImageStyles
Perform additional manipulations to timestamp fields.

Namespace

Drupal\consumer_image_styles\Plugin\jsonapi\FieldEnhancer

Code

public static function stringToBool(array &$element, FormStateInterface $form_state) {
  $new_value = (bool) $form_state
    ->getValue($element['#parents']);
  $form_state
    ->setValue($element['#parents'], $new_value);
}