Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add new methods to override form view parameters

  • Loading branch information...
commit 79bf79bfdd9ad0acfd36bbddbed1645929aeb699 1 parent c50d3ae
@docteurklein docteurklein authored
Showing with 18 additions and 8 deletions.
  1. +18 −8 src/Knp/ControllerBehaviors/Crudable/CrudableBehavior.php
View
26 src/Knp/ControllerBehaviors/Crudable/CrudableBehavior.php
@@ -64,10 +64,10 @@ public function newAction()
$object = $this->createNewObject();
$form = $this->createNewForm($object);
- return $this->render($this->getNewViewPath(), [
+ return $this->render($this->getNewViewPath(), $this->getNewViewParameters([
$this->getObjectSingular() => $object,
'form' => $form->createView(),
- ]);
+ ]));
}
/**
@@ -89,10 +89,10 @@ public function createAction()
return $this->redirect($this->getShowRoute($object));
}
- return $this->render($this->getNewViewPath(), [
+ return $this->render($this->getNewViewPath(), $this->getNewViewParameters([
$this->getObjectSingular() => $object,
'form' => $form->createView(),
- ]);
+ ]));
}
/**
@@ -121,11 +121,11 @@ protected function editObject($object)
$editForm = $this->createEditForm($object);
$deleteForm = $this->createDeleteForm($object);
- return $this->render($this->getEditViewPath(), [
+ return $this->render($this->getEditViewPath(), $this->getEditViewParameters([
$this->getObjectSingular() => $object,
'edit_form' => $editForm->createView(),
'delete_form' => ($deleteForm) ? $deleteForm->createView() : null,
- ]);
+ ]));
}
/**
@@ -167,11 +167,11 @@ protected function updateObject($object)
return $this->redirect($this->getEditRoute($object));
}
- return $this->render($this->getEditViewPath(), [
+ return $this->render($this->getEditViewPath(), $this->getEditViewParameters([
$this->getObjectSingular() => $object,
'edit_form' => $editForm->createView(),
'delete_form' => ($deleteForm) ? $deleteForm->createView() : null,
- ]);
+ ]));
}
/**
@@ -413,6 +413,16 @@ protected function getListViewParameters(array $parameters)
return $parameters;
}
+ protected function getNewViewParameters(array $parameters)
+ {
+ return $parameters;
+ }
+
+ protected function getEditViewParameters(array $parameters)
+ {
+ return $this->getNewViewParameters($parameters);
+ }
+
/**
* Returns object to edit.
*
Please sign in to comment.
Something went wrong with that request. Please try again.