Skip to content

Instantly share code, notes, and snippets.

@tiggr
Created October 6, 2011 12:03
Show Gist options
  • Save tiggr/1267245 to your computer and use it in GitHub Desktop.
Save tiggr/1267245 to your computer and use it in GitHub Desktop.
fluid paginate patch
From c9bc67a27d120d2ff2c391087893b21e12bef91e Mon Sep 17 00:00:00 2001
From: daniel schoene <schoene.it@email.de>
Date: Wed, 1 Jun 2011 18:13:04 +0200
Subject: [PATCH] refs #808 added support to forward action parameters
---
.../Widget/Controller/PaginateController.php | 7 +++++++
Classes/ViewHelpers/Widget/LinkViewHelper.php | 4 +++-
Classes/ViewHelpers/Widget/PaginateViewHelper.php | 3 ++-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/Classes/ViewHelpers/Widget/Controller/PaginateController.php b/Classes/ViewHelpers/Widget/Controller/PaginateController.php
index 652b9d8..2622341 100644
--- a/Classes/ViewHelpers/Widget/Controller/PaginateController.php
+++ b/Classes/ViewHelpers/Widget/Controller/PaginateController.php
@@ -46,12 +46,18 @@ class Tx_Fluid_ViewHelpers_Widget_Controller_PaginateController extends Tx_Fluid
protected $numberOfPages = 1;
/**
+ * @var array
+ */
+ protected $filter;
+
+ /**
* @return void
*/
public function initializeAction() {
$this->objects = $this->widgetConfiguration['objects'];
$this->configuration = t3lib_div::array_merge_recursive_overrule($this->configuration, $this->widgetConfiguration['configuration'], TRUE);
$this->numberOfPages = ceil(count($this->objects) / (integer)$this->configuration['itemsPerPage']);
+ $this->filter = $this->widgetConfiguration['filter'];
}
/**
@@ -81,6 +87,7 @@ class Tx_Fluid_ViewHelpers_Widget_Controller_PaginateController extends Tx_Fluid
));
$this->view->assign('configuration', $this->configuration);
$this->view->assign('pagination', $this->buildPagination());
+ $this->view->assign('filter', $this->filter);
}
/**
diff --git a/Classes/ViewHelpers/Widget/LinkViewHelper.php b/Classes/ViewHelpers/Widget/LinkViewHelper.php
index 331f704..5e30305 100644
--- a/Classes/ViewHelpers/Widget/LinkViewHelper.php
+++ b/Classes/ViewHelpers/Widget/LinkViewHelper.php
@@ -55,6 +55,7 @@ class Tx_Fluid_ViewHelpers_Widget_LinkViewHelper extends Tx_Fluid_Core_ViewHelpe
$this->registerTagAttribute('rel', 'string', 'Specifies the relationship between the current document and the linked document');
$this->registerTagAttribute('rev', 'string', 'Specifies the relationship between the linked document and the current document');
$this->registerTagAttribute('target', 'string', 'Specifies where to open the linked document');
+ $this->registerTagAttribute('actionArguments', 'string', 'Specifies additional arguments for the extbase action');
}
/**
@@ -123,7 +124,8 @@ class Tx_Fluid_ViewHelpers_Widget_LinkViewHelper extends Tx_Fluid_Core_ViewHelpe
}
return $uriBuilder
->reset()
- ->setArguments(array($argumentPrefix => $arguments))
+ ->setArguments(array($argumentPrefix => $arguments,
+ 'tx_nbmaklertool_pi1' => $this->arguments['actionArguments']))
->setSection($this->arguments['section'])
->setAddQueryString(TRUE)
->setArgumentsToBeExcludedFromQueryString(array($argumentPrefix, 'cHash'))
diff --git a/Classes/ViewHelpers/Widget/PaginateViewHelper.php b/Classes/ViewHelpers/Widget/PaginateViewHelper.php
index d40c240..8fb876e 100644
--- a/Classes/ViewHelpers/Widget/PaginateViewHelper.php
+++ b/Classes/ViewHelpers/Widget/PaginateViewHelper.php
@@ -71,9 +71,10 @@ class Tx_Fluid_ViewHelpers_Widget_PaginateViewHelper extends Tx_Fluid_Core_Widge
* @param Tx_Extbase_Persistence_QueryResultInterface $objects
* @param string $as
* @param array $configuration
+ * @param array $filter
* @return string
*/
- public function render(Tx_Extbase_Persistence_QueryResultInterface $objects, $as, array $configuration = array('itemsPerPage' => 10, 'insertAbove' => FALSE, 'insertBelow' => TRUE)) {
+ public function render(Tx_Extbase_Persistence_QueryResultInterface $objects, $as, array $configuration = array('itemsPerPage' => 10, 'insertAbove' => FALSE, 'insertBelow' => TRUE), array $filter = array()) {
return $this->initiateSubRequest();
}
}
--
1.7.2.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment