public function MentionsTypeForm::changeEntityTypeInForm in Open Social 10.2.x
Same name and namespace in other branches
- 8.9 modules/custom/mentions/src/Form/MentionsTypeForm.php \Drupal\mentions\Form\MentionsTypeForm::changeEntityTypeInForm()
- 8 modules/custom/mentions/src/Form/MentionsTypeForm.php \Drupal\mentions\Form\MentionsTypeForm::changeEntityTypeInForm()
- 8.2 modules/custom/mentions/src/Form/MentionsTypeForm.php \Drupal\mentions\Form\MentionsTypeForm::changeEntityTypeInForm()
- 8.3 modules/custom/mentions/src/Form/MentionsTypeForm.php \Drupal\mentions\Form\MentionsTypeForm::changeEntityTypeInForm()
- 8.4 modules/custom/mentions/src/Form/MentionsTypeForm.php \Drupal\mentions\Form\MentionsTypeForm::changeEntityTypeInForm()
- 8.5 modules/custom/mentions/src/Form/MentionsTypeForm.php \Drupal\mentions\Form\MentionsTypeForm::changeEntityTypeInForm()
- 8.6 modules/custom/mentions/src/Form/MentionsTypeForm.php \Drupal\mentions\Form\MentionsTypeForm::changeEntityTypeInForm()
- 8.7 modules/custom/mentions/src/Form/MentionsTypeForm.php \Drupal\mentions\Form\MentionsTypeForm::changeEntityTypeInForm()
- 8.8 modules/custom/mentions/src/Form/MentionsTypeForm.php \Drupal\mentions\Form\MentionsTypeForm::changeEntityTypeInForm()
- 10.3.x modules/custom/mentions/src/Form/MentionsTypeForm.php \Drupal\mentions\Form\MentionsTypeForm::changeEntityTypeInForm()
- 10.0.x modules/custom/mentions/src/Form/MentionsTypeForm.php \Drupal\mentions\Form\MentionsTypeForm::changeEntityTypeInForm()
- 10.1.x modules/custom/mentions/src/Form/MentionsTypeForm.php \Drupal\mentions\Form\MentionsTypeForm::changeEntityTypeInForm()
File
- modules/
custom/ mentions/ src/ Form/ MentionsTypeForm.php, line 266
Class
- MentionsTypeForm
- Class MentionsTypeForm.
Namespace
Drupal\mentions\FormCode
public function changeEntityTypeInForm(array &$form, FormStateInterface $form_state) {
$entitytype_state = $form_state
->getValue([
'input',
'entity_type',
]);
$entitytype_info = $this->entityTypeManager
->getDefinition($entitytype_state);
$id = $entitytype_info
->getKey('id');
$label = $entitytype_info
->getKey('label');
if ($entitytype_state == 'user') {
$label = 'name';
}
unset($form['input']['inputvalue']['#options']);
unset($form['input']['inputvalue']['#default_value']);
$form['input']['inputvalue']['#options'][$id] = $id;
$form['input']['inputvalue']['#options'][$label] = $label;
$form['input']['inputvalue']['#default_value'] = $id;
return $form['input']['inputvalue'];
}