public static function Features::hasComponent in Hook Update Deploy Tools 8
Same name and namespace in other branches
- 7 src/Features.php \HookUpdateDeployTools\Features::hasComponent()
Check that a specific component exists in the Feature.
Parameters
string $feature_name: The machine name of the Feature.
array $components: The name of the component.
Return value
bool TRUE if the Feature has the component.
Throws
HudtException If the Feature does not have the component.
1 call to Features::hasComponent()
- Features::revert in src/
Features.php - Safely revert an array of Features and provide feedback.
File
- src/
Features.php, line 204
Class
- Features
- Public method for reverting Features only if needed.
Namespace
HookUpdateDeployToolsCode
public static function hasComponent($feature_name, $components) {
$states = features_get_component_states(array(
$feature_name,
), FALSE, TRUE);
if (is_array($components)) {
foreach ($components as $component_name) {
if (!isset($states[$feature_name][$component_name])) {
// The component does not exist in this Feature. Throw an exception.
$message = 'The feature @feature has no component of @component.';
$variables = array(
'@feature' => $feature_name,
'@component' => $component_name,
);
throw new HudtException($message, $variables, WATCHDOG_ERROR);
}
}
}
// The component exists.
return TRUE;
}