function _hashtags_get_activated_text_fields in Hashtags 8
Get the field names of the Text type that have Hashtags flag activated
Parameters
$entity_type:
$bundle:
Return value
array
3 calls to _hashtags_get_activated_text_fields()
- ConfirmDeleteForm::submitForm in src/
Form/ ConfirmDeleteForm.php - Form submission handler.
- hashtags_entity_presave in ./
hashtags.module - Implements hook_entity_presave().
- hashtags_uninstall in ./
hashtags.install - Implements hook_uninstall().
File
- ./
hashtags.module, line 395
Code
function _hashtags_get_activated_text_fields($entity_type, $bundle) {
$fields = \Drupal::entityManager()
->getFieldDefinitions($entity_type, $bundle);
$activated_text_fields = [];
foreach ($fields as $field) {
// check if a field is added through Manage Fields (FieldConfig class)
// and it has one of the Text types
$field_name = $field
->getName();
if ($field instanceof FieldConfig && in_array($field
->getType(), _hashtags_get_field_text_types()) && _hashtags_is_field_activated($entity_type, $bundle, $field_name)) {
$activated_text_fields[] = $field_name;
}
}
return $activated_text_fields;
}