function ComponentPluginManager::shouldEnforceSchemas

Same name in this branch
  1. 11.x core/lib/Drupal/Core/Theme/ComponentPluginManager.php \Drupal\Core\Theme\ComponentPluginManager::shouldEnforceSchemas()
Same name in other branches
  1. 10 core/modules/sdc/src/ComponentPluginManager.php \Drupal\sdc\ComponentPluginManager::shouldEnforceSchemas()
  2. 10 core/lib/Drupal/Core/Theme/ComponentPluginManager.php \Drupal\Core\Theme\ComponentPluginManager::shouldEnforceSchemas()

Assess whether schemas are mandatory for props.

Schemas are always mandatory for component provided by modules. It depends on a theme setting for theme components.

Parameters

array $definition: The plugin definition.

Return value

bool TRUE if schemas are mandatory.

2 calls to ComponentPluginManager::shouldEnforceSchemas()
ComponentPluginManager::createInstance in core/modules/sdc/src/ComponentPluginManager.php
Creates an instance.
ComponentPluginManager::isValidDefinition in core/modules/sdc/src/ComponentPluginManager.php
Validates the metadata info.

File

core/modules/sdc/src/ComponentPluginManager.php, line 424

Class

ComponentPluginManager
Defines a plugin manager to deal with sdc.

Namespace

Drupal\sdc

Code

private function shouldEnforceSchemas(array $definition) : bool {
    $provider_type = $definition['extension_type'] ?? NULL;
    if ($provider_type !== ExtensionType::Theme) {
        return TRUE;
    }
    return $this->themeHandler
        ->getTheme($definition['provider'])?->info['enforce_prop_schemas'] ?? FALSE;
}

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