From 8413b4ba33284d3e68c95294e088621462a2a65d Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 18 Apr 2013 14:59:04 +0200 Subject: [PATCH] Move list generation out of TablePager::getLimitSelect() Added TablePager::getLimitSelectList() to get the list of values to show for the drop-down so that it can be used to generate a custom " element of limits. + * This can be passed directly to XmlSelect::addOptions(). + * + * @since 1.22 + * @return array + */ + public function getLimitSelectList() { # Add the current limit from the query string # to avoid that the limit is lost after clicking Go next time if ( !in_array( $this->mLimit, $this->mLimitsShown ) ) { $this->mLimitsShown[] = $this->mLimit; sort( $this->mLimitsShown ); } - $s = Html::openElement( 'select', array( 'name' => 'limit' ) ) . "\n"; + $ret = array(); foreach ( $this->mLimitsShown as $key => $value ) { # The pair is either $index => $limit, in which case the $value # will be numeric, or $limit => $text, in which case the $value @@ -1174,10 +1187,9 @@ abstract class TablePager extends IndexPager { $limit = $key; $text = $value; } - $s .= Xml::option( $text, $limit, $limit == $this->mLimit ) . "\n"; + $ret[$text] = $limit; } - $s .= Html::closeElement( 'select' ); - return $s; + return $ret; } /** -- 2.20.1