[FEATURE] Configure section for pagination widget 72/38272/8
authorBernhard Kraft <kraft@webconsulting.at>
Thu, 26 Mar 2015 20:20:34 +0000 (21:20 +0100)
committerFrank Nägler <frank.naegler@typo3.org>
Mon, 20 Jul 2015 15:20:45 +0000 (17:20 +0200)
Adds a configuration option "section" to the pagination widget so the
links generated by the pagination widget have an anchor (section)
appended to the link. The "widget.link" viewHelper already supports
this.

Change-Id: I59bb958850ec40ca4deabc5c7b7eba8d8903057e
Resolves: #66070
Releases: master
Reviewed-on: http://review.typo3.org/38272
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: David Greiner <hallo@davidgreiner.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Markus Sommer <markussom@posteo.de>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
typo3/sysext/core/Documentation/Changelog/master/Feature-66070-ConfigureSectionForPaginationWidget.rst [new file with mode: 0644]
typo3/sysext/fluid/Classes/ViewHelpers/Widget/Controller/PaginateController.php
typo3/sysext/fluid/Resources/Private/Templates/ViewHelpers/Widget/Paginate/Index.html

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-66070-ConfigureSectionForPaginationWidget.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-66070-ConfigureSectionForPaginationWidget.rst
new file mode 100644 (file)
index 0000000..8b68ca2
--- /dev/null
@@ -0,0 +1,25 @@
+========================================================
+Feature: #66070 - Configure anchor for pagination widget
+========================================================
+
+Description
+===========
+
+This feature allows to add a key "section" to the configuration of a fluid pagination widget. The anchor gets appended to every link of the pagination widget. The "widget.link" viewHelper used by the pagination widget already supports this.
+
+Examples
+--------
+
+The following example will render the page browser having a section parameter "#archive" appended to every link
+
+.. code-block:: html
+
+       <f:widget.paginate objects="{plantpestWarnings}" as="paginatedWarnings" configuration="{section: 'archive', itemsPerPage: 10, insertAbove: 0, insertBelow: 1, maximumNumberOfLinks: 10}">
+       [...]
+       </f:widget.paginate>
+
+
+Impact
+======
+
+If the "section" attribute does not get specified or no configuration is supplied at all then no section parameter (#section) will get appended to the links and the pagination widget behaves as usual.
index fc5c24c..f99f56f 100644 (file)
@@ -38,7 +38,8 @@ class PaginateController extends AbstractWidgetController {
                'insertAbove' => FALSE,
                'insertBelow' => TRUE,
                'maximumNumberOfLinks' => 99,
-               'addQueryStringMethod' => ''
+               'addQueryStringMethod' => '',
+               'section' => ''
        );
 
        /**
index f62e6b8..689adba 100644 (file)
                        <li class="previous">
                                <f:if condition="{pagination.previousPage} > 1">
                                        <f:then>
-                                               <f:widget.link arguments="{currentPage: pagination.previousPage}" addQueryStringMethod="{configuration.addQueryStringMethod}"><f:translate key="widget.pagination.previous" /></f:widget.link>
+                                               <f:widget.link arguments="{currentPage: pagination.previousPage}" addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}"><f:translate key="widget.pagination.previous" /></f:widget.link>
                                        </f:then>
                                        <f:else>
-                                               <f:widget.link addQueryStringMethod="{configuration.addQueryStringMethod}"><f:translate key="widget.pagination.previous" /></f:widget.link>
+                                               <f:widget.link addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}"><f:translate key="widget.pagination.previous" /></f:widget.link>
                                        </f:else>
                                </f:if>
                        </li>
                </f:if>
                <f:if condition="{pagination.displayRangeStart} > 1">
                        <li class="first">
-                               <f:widget.link addQueryStringMethod="{configuration.addQueryStringMethod}">1</f:widget.link>
+                               <f:widget.link addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}">1</f:widget.link>
                        </li>
                </f:if>
                <f:if condition="{pagination.hasLessPages}">
                                        <li>
                                                <f:if condition="{page.number} > 1">
                                                        <f:then>
-                                                               <f:widget.link arguments="{currentPage: page.number}" addQueryStringMethod="{configuration.addQueryStringMethod}">{page.number}</f:widget.link>
+                                                               <f:widget.link arguments="{currentPage: page.number}" addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}">{page.number}</f:widget.link>
                                                        </f:then>
                                                        <f:else>
-                                                               <f:widget.link addQueryStringMethod="{configuration.addQueryStringMethod}">{page.number}</f:widget.link>
+                                                               <f:widget.link addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}">{page.number}</f:widget.link>
                                                        </f:else>
                                                </f:if>
                                        </li>
                </f:if>
                <f:if condition="{pagination.displayRangeEnd} < {pagination.numberOfPages}">
                        <li class="last">
-                               <f:widget.link arguments="{currentPage: pagination.numberOfPages}" addQueryStringMethod="{configuration.addQueryStringMethod}">{pagination.numberOfPages}</f:widget.link>
+                               <f:widget.link arguments="{currentPage: pagination.numberOfPages}" addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}">{pagination.numberOfPages}</f:widget.link>
                        </li>
                </f:if>
                <f:if condition="{pagination.nextPage}">
                        <li class="next">
-                               <f:widget.link arguments="{currentPage: pagination.nextPage}" addQueryStringMethod="{configuration.addQueryStringMethod}"><f:translate key="widget.pagination.next" /></f:widget.link>
+                               <f:widget.link arguments="{currentPage: pagination.nextPage}" addQueryStringMethod="{configuration.addQueryStringMethod}" section="{configuration.section}"><f:translate key="widget.pagination.next" /></f:widget.link>
                        </li>
                </f:if>
        </ul>