function TwigExtension::doValidateProps

Same name in other branches
  1. 10 core/modules/sdc/src/Twig/TwigExtension.php \Drupal\sdc\Twig\TwigExtension::doValidateProps()

Performs the actual validation of the schema for the props.

Parameters

array $context: The context provided to the component.

string $component_id: The component ID.

Return value

bool TRUE if it's valid.

Throws

\Drupal\sdc\Exception\InvalidComponentException

1 call to TwigExtension::doValidateProps()
TwigExtension::validateProps in core/modules/sdc/src/Twig/TwigExtension.php
Validates the props in development environments.

File

core/modules/sdc/src/Twig/TwigExtension.php, line 128

Class

TwigExtension
The twig extension so Drupal can recognize the new code.

Namespace

Drupal\sdc\Twig

Code

protected function doValidateProps(array $context, string $component_id) : bool {
    try {
        return $this->componentValidator
            ->validateProps($context, $this->pluginManager
            ->find($component_id));
    } catch (ComponentNotFoundException $e) {
        throw new InvalidComponentException($e->getMessage(), $e->getCode(), $e);
    }
}

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