class ContentModerationStateForm in Drupal 8
Same name and namespace in other branches
- 9 core/modules/content_moderation/src/Form/ContentModerationStateForm.php \Drupal\content_moderation\Form\ContentModerationStateForm
The content moderation state form.
Hierarchy
- class \Drupal\workflows\Plugin\WorkflowTypeStateFormBase implements PluginAwareInterface, PluginFormInterface uses StringTranslationTrait
- class \Drupal\content_moderation\Form\ContentModerationStateForm
Expanded class hierarchy of ContentModerationStateForm
See also
\Drupal\content_moderation\Plugin\WorkflowType\ContentModeration
File
- core/
modules/ content_moderation/ src/ Form/ ContentModerationStateForm.php, line 14
Namespace
Drupal\content_moderation\FormView source
class ContentModerationStateForm extends WorkflowTypeStateFormBase {
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state, StateInterface $state = NULL) {
/** @var \Drupal\content_moderation\ContentModerationState $state */
$state = $form_state
->get('state');
$is_required_state = isset($state) ? in_array($state
->id(), $this->workflowType
->getRequiredStates(), TRUE) : FALSE;
$form = [];
$form['published'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Published'),
'#description' => $this
->t('When content reaches this state it should be published.'),
'#default_value' => isset($state) ? $state
->isPublishedState() : FALSE,
'#disabled' => $is_required_state,
];
$form['default_revision'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Default revision'),
'#description' => $this
->t('When content reaches this state it should be made the default revision; this is implied for published states.'),
'#default_value' => isset($state) ? $state
->isDefaultRevisionState() : FALSE,
'#disabled' => $is_required_state,
];
return $form;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentModerationStateForm:: |
public | function |
Form constructor. Overrides PluginFormInterface:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
WorkflowTypeStateFormBase:: |
protected | property | The workflow type. | |
WorkflowTypeStateFormBase:: |
public | function |
Sets the plugin for this object. Overrides PluginAwareInterface:: |
|
WorkflowTypeStateFormBase:: |
public | function |
Form submission handler. Overrides PluginFormInterface:: |
|
WorkflowTypeStateFormBase:: |
public | function |
Form validation handler. Overrides PluginFormInterface:: |