I’m attempting to add a new select box to the dialog box that pops up when choosing ‘edit media’ on a media embed in a WYSIWYG. I’m referring to the dialog box that presents options like ‘caption’ and ‘alignment’
I was able to make the field appear by using
function mymodule_form_alter(array &$form, FormStateInterface $form_state, string $form_id) { if($form_id=='editor_media_dialog'){ $form['size'] = [ '#title' => t('Size'), '#type' => 'select', '#options' => [ '' => t('Default'), '-small' => t('Small'), '-medium' => t('Medium'), '-large' => t('Large'), ], ]; } }
but I can’t seem to be able to make that value save in anyway. When saving and reopening the dialog box there is no reference to the new value in $form_state.
What would be the proper way to add fields to the ‘edit media’ dialog box of embedded media entities in a WYSIWYG?