function ExtensionAvailableConstraintValidator::resolveProfile
Resolve the profile based on the given typed data.
Since the profile might have changed while validating, we need to resolve the profile based on the current typed data. This allows us to scan for extensions in the correct profile directory.
Return value
string|false|null The name of the active install profile or distribution, FALSE if there is no install profile or NULL if Drupal is being installed.
1 call to ExtensionAvailableConstraintValidator::resolveProfile()
- ExtensionAvailableConstraintValidator::validate in core/
lib/ Drupal/ Core/ Extension/ Plugin/ Validation/ Constraint/ ExtensionAvailableConstraintValidator.php
File
-
core/
lib/ Drupal/ Core/ Extension/ Plugin/ Validation/ Constraint/ ExtensionAvailableConstraintValidator.php, line 205
Class
- ExtensionAvailableConstraintValidator
- Validates that a given extension exists.
Namespace
Drupal\Core\Extension\Plugin\Validation\ConstraintCode
public function resolveProfile(TypedDataInterface $data) : mixed {
if ($data->getParent()?->getName() === 'core.extension') {
$current_profile = $this->installProfile;
$parent_expression = '%parent.profile';
$profile = TypeResolver::resolveExpression($parent_expression, $data);
if ($profile !== $parent_expression && $profile !== $current_profile) {
return $profile;
}
}
return $this->installProfile;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.