class FormsStepsHelper in Forms Steps 8
Class FormsStepsHelper.
@package Drupal\forms_steps\Service
Hierarchy
- class \Drupal\forms_steps\Service\FormsStepsHelper
Expanded class hierarchy of FormsStepsHelper
1 file declares its use of FormsStepsHelper
- FormsStepsProgressBarBlock.php in src/
Plugin/ Block/ FormsStepsProgressBarBlock.php
1 string reference to 'FormsStepsHelper'
1 service uses FormsStepsHelper
File
- src/
Service/ FormsStepsHelper.php, line 12
Namespace
Drupal\forms_steps\ServiceView source
class FormsStepsHelper {
/**
* FormsStepsManager.
*
* @var \Drupal\forms_steps\Service\FormsStepsManager
*/
protected $formsStepsManager;
/**
* CurrentRouteMatch.
*
* @var \Drupal\Core\Routing\CurrentRouteMatch
*/
private $currentRouteMatch;
/**
* FormsStepsHelper constructor.
*
* @param \Drupal\forms_steps\Service\FormsStepsManager $forms_steps_manager
* Injected FormsStepsManager instance.
* @param \Drupal\Core\Routing\CurrentRouteMatch $current_route_match
* Injected current route match instance.
*/
public function __construct(FormsStepsManager $forms_steps_manager, CurrentRouteMatch $current_route_match) {
$this->formsStepsManager = $forms_steps_manager;
$this->currentRouteMatch = $current_route_match;
}
/**
* Get the workflow instance ID if in a current forms steps route.
*
* @return false|string
* Return the Instance ID or FALSE otherwise.
*/
public function getWorkflowInstanceIdFromRoute() {
$step = $this->formsStepsManager
->getStepByRoute($this->currentRouteMatch
->getRouteName());
// Only return the workflow instance id if the current route is a forms
// steps route.
if ($step) {
$instanceId = $this->currentRouteMatch
->getParameter('instance_id');
return $instanceId;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FormsStepsHelper:: |
private | property | CurrentRouteMatch. | |
FormsStepsHelper:: |
protected | property | FormsStepsManager. | |
FormsStepsHelper:: |
public | function | Get the workflow instance ID if in a current forms steps route. | |
FormsStepsHelper:: |
public | function | FormsStepsHelper constructor. |