Commit c4a5d19 Roderik van der Veer
committed
File tree 3 files changed +21
-1
lines changed
Resources/views/PagePartTwigExtension
3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
3
namespace Kunstmaan \PagePartBundle \Entity ;
4
+ use Kunstmaan \NodeBundle \Entity \PageInterface ;
4
5
use Kunstmaan \PagePartBundle \Helper \PagePartInterface ;
5
6
use Kunstmaan \AdminBundle \Entity \AbstractEntity ;
6
7
use Doctrine \ORM \Mapping as ORM ;
@@ -21,4 +22,15 @@ public function getAdminView()
21
22
{
22
23
return $ this ->getDefaultView ();
23
24
}
25
+
26
+ /**
27
+ * Use this method to override the default view for a specific page type.
28
+ * Also, this implementation guarantees backwards compatibility.
29
+ *
30
+ * @return string
31
+ */
32
+ public function getView (PageInterface $ page = null )
33
+ {
34
+ return $ this ->getDefaultView ();
35
+ }
24
36
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace Kunstmaan \PagePartBundle \Helper ;
4
4
5
+ use Kunstmaan \NodeBundle \Entity \PageInterface ;
5
6
use Symfony \Component \Form \AbstractType ;
6
7
7
8
/**
@@ -24,6 +25,13 @@ public function getDefaultView();
24
25
*/
25
26
public function getAdminView ();
26
27
28
+ /**
29
+ * This method can be used to override the default view for a specific page type
30
+ * @abstract
31
+ * @return string
32
+ */
33
+ public function getView (PageInterface $ page = null );
34
+
27
35
/**
28
36
* @return AbstractType
29
37
*/
Original file line number Diff line number Diff line change 1
1
{% for box in pageparts %}
2
2
{% set resource = box %}
3
- {% include box .defaultview %}
3
+ {% include box.getView ( page ) %}
4
4
{% endfor %}
You can’t perform that action at this time.
0 commit comments