function WorkspaceDeployForm::actions
Overrides EntityForm::actions
File
-
core/
modules/ workspaces/ src/ Form/ WorkspaceDeployForm.php, line 115
Class
- WorkspaceDeployForm
- Provides the workspace deploy form.
Namespace
Drupal\workspaces\FormCode
public function actions(array $form, FormStateInterface $form_state) {
$elements = parent::actions($form, $form_state);
unset($elements['delete']);
$workspace_publisher = $this->workspaceOperationFactory
->getPublisher($this->entity);
if (isset($form['deploy'])) {
$total_count = $form['deploy']['#total_count'];
$elements['submit']['#value'] = $this->formatPlural($total_count, 'Deploy @count item to @target', 'Deploy @count items to @target', [
'@target' => $workspace_publisher->getTargetLabel(),
]);
$elements['submit']['#submit'] = [
'::submitForm',
'::deploy',
];
}
else {
// Do not allow the 'Deploy' operation if there's nothing to push.
$elements['submit']['#value'] = $this->t('Deploy');
$elements['submit']['#disabled'] = TRUE;
}
$elements['cancel'] = [
'#type' => 'link',
'#title' => $this->t('Cancel'),
'#attributes' => [
'class' => [
'button',
],
],
'#url' => $this->entity
->toUrl('collection'),
];
return $elements;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.