You are here

public static function ImageCrop::hasCropValues in Image Widget Crop 8.2

Evaluate if element has crop values in form states.

Parameters

array $element: An associative array containing the properties and children of the form actions container.

string $type: Id of current crop type.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

bool True if crop element have values or False if not.

1 call to ImageCrop::hasCropValues()
ImageCrop::processCrop in src/Element/ImageCrop.php
Render API callback: Expands the image_crop element type.

File

src/Element/ImageCrop.php, line 546

Class

ImageCrop
Provides a form element for crop.

Namespace

Drupal\image_widget_crop\Element

Code

public static function hasCropValues(array $element, $type, FormStateInterface $form_state) {
  $form_state_values = $form_state
    ->getValue($element['#parents']);
  return !empty($form_state_values) && isset($form_state_values['crop_wrapper'][$type]);
}