function social_group_flexible_group_type_allowed_values_function in Open Social 10.2.x
Same name and namespace in other branches
- 10.3.x modules/social_features/social_group/modules/social_group_flexible_group/social_group_flexible_group.module \social_group_flexible_group_type_allowed_values_function()
- 10.0.x modules/social_features/social_group/modules/social_group_flexible_group/social_group_flexible_group.module \social_group_flexible_group_type_allowed_values_function()
- 10.1.x modules/social_features/social_group/modules/social_group_flexible_group/social_group_flexible_group.module \social_group_flexible_group_type_allowed_values_function()
Sets dynamic allowed values for the group type icon field.
2 string references to 'social_group_flexible_group_type_allowed_values_function'
- field.storage.taxonomy_term.field_group_type_icon.yml in modules/
social_features/ social_group/ modules/ social_group_flexible_group/ config/ install/ field.storage.taxonomy_term.field_group_type_icon.yml - modules/social_features/social_group/modules/social_group_flexible_group/config/install/field.storage.taxonomy_term.field_group_type_icon.yml
- social_group_flexible_group_update_8910.yml in modules/
social_features/ social_group/ modules/ social_group_flexible_group/ config/ update/ social_group_flexible_group_update_8910.yml - modules/social_features/social_group/modules/social_group_flexible_group/config/update/social_group_flexible_group_update_8910.yml
File
- modules/
social_features/ social_group/ modules/ social_group_flexible_group/ social_group_flexible_group.module, line 796 - The Social Group Flexible Group module.
Code
function social_group_flexible_group_type_allowed_values_function(FieldStorageConfig $definition, ContentEntityInterface $entity = NULL, $cacheable) {
$theme_path = drupal_get_path('theme', 'socialbase');
$icon_files = \Drupal::service('file_system')
->scanDirectory(DRUPAL_ROOT . '/' . $theme_path . '/components/06-libraries/icons/source', '/^icon-.*\\.svg$/', [
'recurse' => FALSE,
]);
$options = [];
foreach ($icon_files as $file) {
$options[$file->name] = $file->name;
}
return $options;
}