Skip to content
Snippets Groups Projects

Issue #3412897 Support displaying transition buttons as a dropbutton

2 files
+ 41
6
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -113,15 +113,30 @@ class StateTransitionForm extends FormBase implements StateTransitionFormInterfa
return;
}
$form['actions'] = [
'#type' => 'container',
];
$display_dropbuttons = $form_state->get('display_dropbuttons');
if ($display_dropbuttons) {
$form['actions'] = [
'#type' => 'actions',
'#suffix' => '<div class="clearfix"></div>',
];
}
else {
$form['actions'] = [
'#type' => 'container',
];
}
// Determine whether we should output links to the confirmation form,
// or submit buttons.
$require_confirmation = $form_state->get('require_confirmation');
foreach ($state_item->getTransitions() as $transition_id => $transition) {
$form['actions'][$transition_id] = [];
if ($display_dropbuttons) {
$form['actions'][$transition_id]['#dropbutton'] = 'state';
}
if (!$require_confirmation) {
$form['actions'][$transition_id] = [
$form['actions'][$transition_id] += [
'#type' => 'submit',
'#value' => $transition->getLabel(),
'#submit' => ['::submitForm'],
@@ -136,7 +151,7 @@ class StateTransitionForm extends FormBase implements StateTransitionFormInterfa
'transition_id' => $transition_id,
];
$form['actions'][$transition_id] = [
$form['actions'][$transition_id] += [
'#type' => 'link',
'#title' => $transition->getLabel(),
'#url' => Url::fromRoute("entity.{$this->entity->getEntityTypeId()}.state_transition_form", $route_parameters, [
Loading