Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use FormFlowInterface in TwigExtension instead of concrete class #295

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Twig/Extension/FormFlowExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Craue\FormFlowBundle\Twig\Extension;

use Craue\FormFlowBundle\Form\FormFlow;
use Craue\FormFlowBundle\Form\FormFlowInterface;
use Craue\FormFlowBundle\Util\FormFlowUtil;

/**
Expand Down Expand Up @@ -55,30 +55,30 @@ public function getFunctions() {
/**
* Adds route parameters for dynamic step navigation.
* @param array $parameters Current route parameters.
* @param FormFlow $flow The flow involved.
* @param FormFlowInterface $flow The flow involved.
* @param int $stepNumber Number of the step the link will be generated for.
* @return array Route parameters plus instance and step parameter.
*/
public function addDynamicStepNavigationParameters(array $parameters, FormFlow $flow, $stepNumber) {
public function addDynamicStepNavigationParameters(array $parameters, FormFlowInterface $flow, $stepNumber) {
return $this->formFlowUtil->addRouteParameters($parameters, $flow, $stepNumber);
}

/**
* Removes route parameters for dynamic step navigation.
* @param array $parameters Current route parameters.
* @param FormFlow $flow The flow involved.
* @param FormFlowInterface $flow The flow involved.
* @return array Route parameters without instance and step parameter.
*/
public function removeDynamicStepNavigationParameters(array $parameters, FormFlow $flow) {
public function removeDynamicStepNavigationParameters(array $parameters, FormFlowInterface $flow) {
return $this->formFlowUtil->removeRouteParameters($parameters, $flow);
}

/**
* @param FormFlow $flow The flow involved.
* @param FormFlowInterface $flow The flow involved.
* @param int $stepNumber Number of the step the link will be generated for.
* @return bool If the step can be linked to.
*/
public function isStepLinkable(FormFlow $flow, $stepNumber) {
public function isStepLinkable(FormFlowInterface $flow, $stepNumber) {
if (!$flow->isAllowDynamicStepNavigation()
|| $flow->getCurrentStepNumber() === $stepNumber
|| $flow->isStepSkipped($stepNumber)) {
Expand All @@ -105,12 +105,12 @@ public function isStepLinkable(FormFlow $flow, $stepNumber) {

// methods for BC with third-party templates (e.g. MopaBootstrapBundle)

public function addDynamicStepNavigationParameter(array $parameters, FormFlow $flow, $stepNumber) {
public function addDynamicStepNavigationParameter(array $parameters, FormFlowInterface $flow, $stepNumber) {
@trigger_error('Twig filter craue_addDynamicStepNavigationParameter is deprecated since version 3.0. Use filter craue_addDynamicStepNavigationParameters instead.', E_USER_DEPRECATED);
return $this->addDynamicStepNavigationParameters($parameters, $flow, $stepNumber);
}

public function removeDynamicStepNavigationParameter(array $parameters, FormFlow $flow) {
public function removeDynamicStepNavigationParameter(array $parameters, FormFlowInterface $flow) {
@trigger_error('Twig filter craue_removeDynamicStepNavigationParameter is deprecated since version 3.0. Use filter craue_removeDynamicStepNavigationParameters instead.', E_USER_DEPRECATED);
return $this->removeDynamicStepNavigationParameters($parameters, $flow);
}
Expand Down