You are here

public static function FileMetadataCaching::validateCaching in File metadata manager 8

Same name and namespace in other branches
  1. 8.2 src/Element/FileMetadataCaching.php \Drupal\file_mdm\Element\FileMetadataCaching::validateCaching()

Form element validation handler.

File

src/Element/FileMetadataCaching.php, line 103

Class

FileMetadataCaching
Implements a form element to enable capturing cache information for file_mdm.

Namespace

Drupal\file_mdm\Element

Code

public static function validateCaching(&$element, FormStateInterface $form_state, &$complete_form) {

  // Validate cache exclusion paths.
  foreach ($element['#value']['disallowed_paths'] as $path) {
    if (!file_valid_uri($path)) {
      $form_state
        ->setError($element['disallowed_paths'], t("'@path' is an invalid URI path", [
        '@path' => $path,
      ]));
    }
  }
}