protected function BulkEditFormTrait::getRevisionForm in Views Bulk Edit 8.2
Builds the revision form.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The fake entity.
Return value
array The revision form.
1 call to BulkEditFormTrait::getRevisionForm()
- BulkEditFormTrait::getBundleForm in src/
Form/ BulkEditFormTrait.php - Gets the form for this entity display.
File
- src/
Form/ BulkEditFormTrait.php, line 151
Class
- BulkEditFormTrait
- Common methods for Views Bulk Edit forms.
Namespace
Drupal\views_bulk_edit\FormCode
protected function getRevisionForm(EntityInterface $entity) {
$revision_form = [];
if ($entity instanceof RevisionLogInterface && !empty($revision_key = $entity
->getEntityType()
->getKey('revision')) && $entity
->get($revision_key)
->access('update')) {
$new_revision_default = $this
->getNewRevisionDefault($entity);
$revision_form['revision_information'] = [
'#type' => 'fieldset',
'#weight' => 200,
'#title' => $this
->t('Revision information'),
];
$revision_form['revision_information']['revision'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Create new revision'),
'#default_value' => $new_revision_default,
];
$revision_form['revision_information']['revision_log'] = [
'#type' => 'textarea',
'#title' => $this
->t('Revision log message'),
'#description' => $this
->t('Briefly describe the changes you have made.'),
'#states' => [
'visible' => [
sprintf(':input[name="%s[%s][revision_information][revision]"]', $entity
->getEntityTypeId(), $entity
->bundle()) => [
'checked' => TRUE,
],
],
],
];
}
return $revision_form;
}