You are here

public function CropWidgetForm::setDefaultLibrariesUrls in Image Widget Crop 8.2

Set the default state of cropper libraries files url.

Parameters

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

1 call to CropWidgetForm::setDefaultLibrariesUrls()
CropWidgetForm::submitForm in src/Form/CropWidgetForm.php
Form submission handler.

File

src/Form/CropWidgetForm.php, line 294

Class

CropWidgetForm
Configure ImageWidgetCrop general settings for this site.

Namespace

Drupal\image_widget_crop\Form

Code

public function setDefaultLibrariesUrls(FormStateInterface $form_state) {
  if (empty($form_state
    ->getValue('library_url')) || empty($form_state
    ->getValue('css_url'))) {
    $form_state
      ->setValue('library_url', $form_state
      ->getCompleteForm()['library']['library_url']['#attributes']['placeholder']);
    $form_state
      ->setValue('css_url', $form_state
      ->getCompleteForm()['library']['css_url']['#attributes']['placeholder']);
  }
}