I would love to have this in the cmf bundle, think it is useful. The problem with a class/interface parameter for filtering is that it would need to be fqn name and violate the separation between application and templating a bit. But imho it would be worth it. And its more generic than a specific method for routeaware. @lsmith77 what do you think? Separate twig function or filter? Or other ideas?

----- Reply message -----
Von: "Joiz" <notifications@github.com>
An: "symfony-cmf/CoreBundle" <CoreBundle@noreply.github.com>
Cc: "David Buchmann" <david@liip.ch>
Betreff: [CoreBundle] twig prev next fixed (#24)
Datum: Mi., Mär. 6, 2013 17:34
In Twig/TwigExtension.php:
> @@ -96,7 +97,7 @@ private function search($current, $reverse = false)
>              if ($check) {
>                  try {
>                      $child = $this->dm->find(null, $parent->getPath().'/'.$name);
> -                    if ($this->publishWorkflowChecker->checkIsPublished($child)) {
> +                    if ($this->publishWorkflowChecker->checkIsPublished($child) && $child instanceof RouteAwareInterface) {

ok -  cmf_prev_link and cmf_next_link sounds good to me - so you want me to write my own twig extensions in my site or do you still think it might be useful to have this available for all people?
i dont see the case of getting any other "next" or "prev" content inside twig - but there might be one :)
or could you send in a second paramter to the twig method which will be a class reference? if the "next" or "prev" object doesnt match the argment class it will return null
this one would avoid the hard reference
eric
…
On 06.03.2013, at 17:22, David Buchmann <notifications@github.com> wrote:
In Twig/TwigExtension.php:

> @@ -96,7 +97,7 @@ private function search($current, $reverse = false)
>              if ($check) {
>                  try {
>                      $child = $this->dm->find(null, $parent->getPath().'/'.$name);
> -                    if ($this->publishWorkflowChecker->checkIsPublished($child)) {
> +                    if ($this->publishWorkflowChecker->checkIsPublished($child) && $child instanceof RouteAwareInterface) {
this depends on what you want you want to do. i could use this to loop over children with something else than a route.

i think we could do a cmf_prev_link and cmf_next_link that creates the route right away, using the RouteAwareInterface to filter. then you can only call those if you have RoutingExtraBundle (because the interface is used in your check) and if you want the actual objects, you can still use cmf_prev / cmf_next to get any kind of content. wdyt?

the problem is we introduce a dependency on the routing component with this. either we need to write the code in a way that checks if interface_exists and only does the instanceof check if so. or we say

—
Reply to this email directly or view it on GitHub.



&mdash;
Reply to this email directly or view it on GitHub.