public function MappingEditFormBase::getVocabularyId in GatherContent 8.5
Same name and namespace in other branches
- 8.4 gathercontent_ui/src/Form/MappingEditFormBase.php \Drupal\gathercontent_ui\Form\MappingEditFormBase::getVocabularyId()
Get vocabulary identifier for field in content type.
Parameters
string $field_id: ID of local field.
Return value
string Identifier of vocabulary.
1 call to MappingEditFormBase::getVocabularyId()
- MappingEditForm::submitForm in gathercontent_ui/
src/ Form/ MappingEditForm.php - This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
File
- gathercontent_ui/
src/ Form/ MappingEditFormBase.php, line 517
Class
- MappingEditFormBase
- Class MappingEditFormBase.
Namespace
Drupal\gathercontent_ui\FormCode
public function getVocabularyId($field_id) {
// Load vocabulary.
$id_array = explode('||', $field_id);
$field_config = FieldConfig::load($id_array[count($id_array) - 1]);
$settings = $field_config
->getSetting('handler_settings');
/** @var \Drupal\taxonomy\Entity\Term[] $terms */
if (!empty($settings['auto_create_bundle'])) {
$vid = $settings['auto_create_bundle'];
return $vid;
}
else {
$vid = reset($settings['target_bundles']);
return $vid;
}
}