function field_collection_form_field_config_edit_form_alter in Field collection 8.3
Same name and namespace in other branches
- 8 field_collection.module \field_collection_form_field_config_edit_form_alter()
Implements hood_form_FORM_ID_alter() for field_ui_field_edit_form.
Remove default value from field collection field settings.
File
- ./
field_collection.module, line 112 - Module implementing field collection field type.
Code
function field_collection_form_field_config_edit_form_alter(&$form, FormStateInterface $form_state) {
if ($form_state
->getFormObject()
->getEntity()
->getType() == 'field_collection') {
unset($form['default_value']['widget']);
$url = Url::fromRoute('entity.field_collection.edit_form', [
'field_collection' => $form_state
->getFormObject()
->getEntity()
->getName(),
])
->setAbsolute()
->toString();
$form['default_value']['#description'] = t('To specify a default value, configure it via the regular default value setting of each field that is part of the field collection. To do so, go to the <a href=":url/fields">manage fields</a> screen of the field collection.', [
':url' => $url,
]);
}
}