function RecursiveValidator::getMetadataFor

Same name in other branches
  1. 9 core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php \Drupal\Core\TypedData\Validation\RecursiveValidator::getMetadataFor()
  2. 8.9.x core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php \Drupal\Core\TypedData\Validation\RecursiveValidator::getMetadataFor()
  3. 11.x core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php \Drupal\Core\TypedData\Validation\RecursiveValidator::getMetadataFor()

Parameters

\Drupal\Core\TypedData\TypedDataInterface $typed_data: A typed data object containing the value to validate.

File

core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php, line 74

Class

RecursiveValidator
Defines a recursive validator for Typed Data.

Namespace

Drupal\Core\TypedData\Validation

Code

public function getMetadataFor($typed_data) : MetadataInterface {
    if (!$typed_data instanceof TypedDataInterface) {
        throw new \InvalidArgumentException('The passed value must be a typed data object.');
    }
    return new TypedDataMetadata($typed_data);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.