protected function OptionalModuleManager::validateSocialFeatureData in Open Social 10.0.x
Same name and namespace in other branches
- 8.9 src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::validateSocialFeatureData()
- 8.8 src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::validateSocialFeatureData()
- 10.3.x src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::validateSocialFeatureData()
- 10.1.x src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::validateSocialFeatureData()
- 10.2.x src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::validateSocialFeatureData()
Validate the data for an Open Social optional feature.
Parameters
string $module_name: The name of the module that's being validated for error messages.
array $info: The array of info to validate.
Return value
true Returns TRUE when the data is valid.
Throws
\Drupal\social\Exception\SocialFeatureDataException An exception that indicates what's wrong with the data.
2 calls to OptionalModuleManager::validateSocialFeatureData()
- OptionalModuleManager::getInstallProfileFeatureDefinitions in src/
Installer/ OptionalModuleManager.php - Loads feature definitions from a `profile.feature_list.yml` in the profile.
- OptionalModuleManager::getOptionalModuleInfo in src/
Installer/ OptionalModuleManager.php - Load the optional module info for the extension.
File
- src/
Installer/ OptionalModuleManager.php, line 180
Class
- OptionalModuleManager
- Optional Module Manager.
Namespace
Drupal\social\InstallerCode
protected function validateSocialFeatureData(string $module_name, array $info) : bool {
if (!isset($info['name'])) {
throw new SocialFeatureDataException("Missing `name` field in `{$module_name}.social_feature.yml`.");
}
if (!isset($info['description'])) {
throw new SocialFeatureDataException("Missing `description` field in `{$module_name}.social_feature.yml`.");
}
if (!is_bool($info['default'])) {
throw new SocialFeatureDataException("Field `default` must be of type `bool` in `{$module_name}.social_feature.yml`.");
}
if (!is_int($info['weight'])) {
throw new SocialFeatureDataException("Field `weight` must be of type `int` in `{$module_name}.social_feature.yml`.");
}
return TRUE;
}