Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ComponentsTwigExtension.php

function ComponentsTwigExtension::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\Core\Render\Component\Exception\InvalidComponentException

1 call to ComponentsTwigExtension::doValidateProps()
ComponentsTwigExtension::validateProps in core/lib/Drupal/Core/Template/ComponentsTwigExtension.php
Validates the props in development environments.

File

core/lib/Drupal/Core/Template/ComponentsTwigExtension.php, line 119

Class

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

Namespace

Drupal\Core\Template

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);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal