- admin/structure/display-modes/form
- Note what you name this, as it will be referenced as 'form_mode'
- admin/structure/{entity_name}/settings/form-display
- Note the 'form_display' will be the 'entity_name.form_mode'
- admin/structure/{entity_name}/settings/form-display/{form_mode}
use Drupal\Core\Form\FormStateInterface;
class WeeklyReleaseForm extends SeriesReleaseForm {
public function getFormId() {
return 'weekly_release';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
// Manipulate form further if you want
return $form;
}
Create the route to the new form which will use the form display (new form will be created in the last step)
module_name.route_name_to_form:
path: '/whatever/path/here'
defaults:
_entity_form: '{form_display}'
_title: 'Form Title'
requirements:
_permission: 'whatever permissions'
function module_name_entity_type_build(array &$entity_types) {
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
$entity_types['{entity_name}']->setFormClass('{form_mode}', 'Drupal\{module_name}\Form\{FormName}');
}