class Step in Forms Steps 8
A value object representing a step state.
Hierarchy
- class \Drupal\forms_steps\Step implements StepInterface
Expanded class hierarchy of Step
5 files declare their use of Step
- FormsSteps.php in src/
Entity/ FormsSteps.php - FormsStepsAlter.php in src/
Form/ FormsStepsAlter.php - RouteHelper.php in src/
Service/ RouteHelper.php - StepChangeEvent.php in src/
Event/ StepChangeEvent.php - WorkflowListBuilder.php in src/
Controller/ WorkflowListBuilder.php
4 string references to 'Step'
- FormsStepsEditForm::form in src/
Form/ FormsStepsEditForm.php - Gets the actual form array to be built.
- FormsStepsStepFormBase::form in src/
Form/ FormsStepsStepFormBase.php - Gets the actual form array to be built.
- forms_steps.schema.yml in config/
schema/ forms_steps.schema.yml - config/schema/forms_steps.schema.yml
- WorkflowListBuilder::buildHeader in src/
Controller/ WorkflowListBuilder.php - Building the header and content lines for the contact list.
File
- src/
Step.php, line 8
Namespace
Drupal\forms_stepsView source
class Step implements StepInterface {
/**
* The forms_steps the step is attached to.
*
* @var \Drupal\forms_steps\FormsStepsInterface
*/
protected $formsSteps;
/**
* The step's ID.
*
* @var string
*/
protected $id;
/**
* The step's label.
*
* @var string
*/
protected $label;
/**
* The step's weight.
*
* @var int
*/
protected $weight;
/**
* The step's entity_type.
*
* @var string
*/
protected $entityType;
/**
* The step's entity_bundle.
*
* @var string
*/
protected $entityBundle;
/**
* The step's form_view_mode_id.
*
* @var string
*/
protected $formMode;
/**
* The step's URL.
*
* @var string
*/
protected $url;
/**
* The step's submit label.
*
* @var string
*/
protected $submitLabel;
/**
* The step's cancel label.
*
* @var string
*/
protected $cancelLabel;
/**
* The step's delete label.
*
* @var string
*/
protected $deleteLabel;
/**
* The step's cancel route.
*
* @var string
*/
protected $cancelRoute;
/**
* The step's cancel step.
*
* @var \Drupal\forms_steps\Step
*/
protected $cancelStep;
/**
* The step's cancel step mode.
*
* @var string
*/
protected $cancelStepMode;
/**
* The step's delete state.
*
* @var bool
*/
protected $hideDelete;
/**
* The step's previous label.
*
* @var string
*/
protected $previousLabel;
/**
* The step's previous state.
*
* @var bool
*/
protected $displayPrevious;
/**
* Step constructor.
*
* @param \Drupal\forms_Steps\FormsStepsInterface $forms_steps
* The forms_steps the step is attached to.
* @param string $id
* The step's ID.
* @param string $label
* The step's label.
* @param int $weight
* The step's weight.
* @param string $entityType
* The step's entity type.
* @param string $entityBundle
* The step's bundle.
* @param string $formMode
* The step's form mode.
* @param string $url
* The step's URL.
*/
public function __construct(FormsStepsInterface $forms_steps, $id, $label, $weight, $entityType, $entityBundle, $formMode, $url) {
$this->formsSteps = $forms_steps;
$this->id = $id;
$this->label = $label;
$this->weight = $weight;
$this->entityType = $entityType;
$this->entityBundle = $entityBundle;
$this->formMode = $formMode;
$this->url = $url;
}
/**
* {@inheritdoc}
*/
public function id() {
return $this->id;
}
/**
* {@inheritdoc}
*/
public function label() {
return $this->label;
}
/**
* {@inheritdoc}
*/
public function weight() {
return $this->weight;
}
/**
* {@inheritdoc}
*/
public function entityType() {
return $this->entityType;
}
/**
* {@inheritdoc}
*/
public function entityBundle() {
return $this->entityBundle;
}
/**
* {@inheritdoc}
*/
public function formMode() {
return $this->formMode;
}
/**
* {@inheritdoc}
*/
public function url() {
return $this->url;
}
/**
* Return a list of form modes available for this entity bundle.
*
* @return array
* Returns the list of form modes.
*/
public function formModes() {
$result = [];
// Get the list of available form modes for a certain entity type.
$form_modes = \Drupal::service('entity_display.repository')
->getFormModes($this->entityType);
foreach ($form_modes as $form_mode) {
$result[$form_mode['id']] = $form_mode['label'];
}
$result['default'] = 'Default';
return $result;
}
/**
* Gets the submit label.
*
* @return string
* The submit label.
*/
public function submitLabel() {
return $this->submitLabel;
}
/**
* Gets the cancel label.
*
* @return string
* The cancel label.
*/
public function cancelLabel() {
return $this->cancelLabel;
}
/**
* Gets the delete label.
*
* @return string
* The delete label.
*/
public function deleteLabel() {
return $this->deleteLabel;
}
/**
* Gets the cancel route.
*
* @return string
* The cancel route.
*/
public function cancelRoute() {
return $this->cancelRoute;
}
/**
* Gets the cancel step.
*
* @return \Drupal\forms_steps\Step
* The cancel step.
*/
public function cancelStep() {
return $this->cancelStep;
}
/**
* Get the hidden status of the delete button.
*
* @return bool
* TRUE if hidden | FALSE otherwise
*/
public function hideDelete() {
return $this->hideDelete;
}
/**
* Set the hidden state of the delete button.
*
* @param bool $value
* TRUE if hidden | FALSE otherwise.
*/
public function setHideDelete($value) {
$this->hideDelete = $value;
}
/**
* Gets the cancel step mode.
*
* @return string
* The cancel step mode.
*/
public function cancelStepMode() {
return $this->cancelStepMode;
}
/**
* {@inheritdoc}
*/
public function setSubmitLabel($label) {
$this->submitLabel = $label;
}
/**
* {@inheritdoc}
*/
public function setCancelLabel($label) {
$this->cancelLabel = $label;
}
/**
* {@inheritdoc}
*/
public function setDeleteLabel($label) {
$this->deleteLabel = $label;
}
/**
* {@inheritdoc}
*/
public function setCancelRoute($route) {
$this->cancelRoute = $route;
}
/**
* {@inheritdoc}
*/
public function setCancelStep(Step $step) {
$this->cancelStep = $step;
}
/**
* {@inheritdoc}
*/
public function setCancelStepMode($mode) {
$this->cancelStepMode = $mode;
}
/**
* {@inheritdoc}
*/
public function formsSteps() {
return $this->formsSteps;
}
/**
* {@inheritdoc}
*/
public function displayPrevious() {
return $this->displayPrevious;
}
/**
* {@inheritdoc}
*/
public function setPreviousLabel($label) {
$this->previousLabel = $label;
}
/**
* {@inheritdoc}
*/
public function previousLabel() {
return $this->previousLabel;
}
/**
* {@inheritdoc}
*/
public function setDisplayPrevious($value) {
return $this->displayPrevious = $value;
}
/**
* {@inheritdoc}
*/
public function isLast() {
$last_step = $this->formsSteps
->getLastStep();
if ($this->id == $last_step
->id()) {
return TRUE;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Step:: |
protected | property | The step's cancel label. | |
Step:: |
protected | property | The step's cancel route. | |
Step:: |
protected | property | The step's cancel step. | |
Step:: |
protected | property | The step's cancel step mode. | |
Step:: |
protected | property | The step's delete label. | |
Step:: |
protected | property | The step's previous state. | |
Step:: |
protected | property | The step's entity_bundle. | |
Step:: |
protected | property | The step's entity_type. | |
Step:: |
protected | property | The step's form_view_mode_id. | |
Step:: |
protected | property | The forms_steps the step is attached to. | |
Step:: |
protected | property | The step's delete state. | |
Step:: |
protected | property | The step's ID. | |
Step:: |
protected | property | The step's label. | |
Step:: |
protected | property | The step's previous label. | |
Step:: |
protected | property | The step's submit label. | |
Step:: |
protected | property | The step's URL. | |
Step:: |
protected | property | The step's weight. | |
Step:: |
public | function |
Gets the cancel label. Overrides StepInterface:: |
|
Step:: |
public | function |
Gets the cancel route. Overrides StepInterface:: |
|
Step:: |
public | function |
Gets the cancel step. Overrides StepInterface:: |
|
Step:: |
public | function |
Gets the cancel step mode. Overrides StepInterface:: |
|
Step:: |
public | function | Gets the delete label. | |
Step:: |
public | function |
Get the display status of the previous button. Overrides StepInterface:: |
|
Step:: |
public | function |
Gets the step's bundle. Overrides StepInterface:: |
|
Step:: |
public | function |
Gets the step's entity type. Overrides StepInterface:: |
|
Step:: |
public | function |
Gets the step's form mode. Overrides StepInterface:: |
|
Step:: |
public | function | Return a list of form modes available for this entity bundle. | |
Step:: |
public | function |
Get the forms steps object parent to this step. Overrides StepInterface:: |
|
Step:: |
public | function |
Get the hidden status of the delete button. Overrides StepInterface:: |
|
Step:: |
public | function |
Gets the step's ID. Overrides StepInterface:: |
|
Step:: |
public | function |
Determines if the step is the last one on its forms steps entity. Overrides StepInterface:: |
|
Step:: |
public | function |
Gets the step's label. Overrides StepInterface:: |
|
Step:: |
public | function |
Gets the previous label. Overrides StepInterface:: |
|
Step:: |
public | function |
Set the cancel label. Overrides StepInterface:: |
|
Step:: |
public | function |
Set the cancel route. Overrides StepInterface:: |
|
Step:: |
public | function |
Set the cancel step. Overrides StepInterface:: |
|
Step:: |
public | function |
Set the cancel step mode. Overrides StepInterface:: |
|
Step:: |
public | function |
Set the delete label. Overrides StepInterface:: |
|
Step:: |
public | function |
Set the display state of the previous button. Overrides StepInterface:: |
|
Step:: |
public | function |
Set the hidden state of the delete button. Overrides StepInterface:: |
|
Step:: |
public | function |
Set the previous label. Overrides StepInterface:: |
|
Step:: |
public | function |
Set the submit label. Overrides StepInterface:: |
|
Step:: |
public | function |
Gets the submit label. Overrides StepInterface:: |
|
Step:: |
public | function |
Gets the step's url. Overrides StepInterface:: |
|
Step:: |
public | function |
Gets the step's weight. Overrides StepInterface:: |
|
Step:: |
public | function | Step constructor. |