You are here

public static function EmbedSettingsForm::validateDirectory in Embed 8

Form API callback.

Removes slashes from the beginning and end of the destination value and ensures that the file directory path is not included at the beginning of the value.

This function is assigned as an #element_validate callback in fieldSettingsForm().

File

src/Form/EmbedSettingsForm.php, line 97

Class

EmbedSettingsForm
Configure embed settings for this site.

Namespace

Drupal\embed\Form

Code

public static function validateDirectory($element, FormStateInterface $form_state) {

  // Strip slashes from the beginning and end of $element['file_directory'].
  $value = trim($element['#value'], '\\/');
  $form_state
    ->setValueForElement($element, $value);
}