Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/113506
Change subject: Use new history params callback stuff for history
......................................................................
Use new history params callback stuff for history
Change-Id: I60e3c16f6f0c1310077fa6a8791bbd380d959e72
---
M FlowActions.php
M includes/View/History/HistoryRecord.php
M includes/View/History/HistoryRenderer.php
3 files changed, 16 insertions(+), 35 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/06/113506/1
diff --git a/FlowActions.php b/FlowActions.php
index e6597c1..b54c514 100644
--- a/FlowActions.php
+++ b/FlowActions.php
@@ -23,7 +23,7 @@
* * history: all history-related information:
* * i18n-message: the i18n message key for this change type
* * i18n-params: array of i18n parameters for the provided message (see
- * HistoryRecord::buildMessage phpdoc for more details)
+ * AbstractFormatter::processParam phpdoc for more details)
* * class: classname to be added to the list-item for this changetype
* * bundle: array with, again, all of the above information if multiple
types
* should be bundled (then the bundle i18n & class will be used to generate
diff --git a/includes/View/History/HistoryRecord.php
b/includes/View/History/HistoryRecord.php
index 4483173..95d7bf0 100644
--- a/includes/View/History/HistoryRecord.php
+++ b/includes/View/History/HistoryRecord.php
@@ -96,15 +96,12 @@
* to this method, be be passed along to the callback functions that
* generate the final message parameters, per message.
*
- * @param $callbackParam1[optional] Callback parameter
- * @param $callbackParam2[optional] Second callback parameter (this
method
- * can be overloaded, all params will be passed along)
* @return Message
*/
- public function getMessage( $callbackParam1 = null /*[,
$callbackParam2[, ...]] */ ) {
+ public function getMessageParams() {
$details = $this->getActionDetails( $this->getType() );
$params = isset( $details['i18n-params'] ) ?
$details['i18n-params'] : array();
- return $this->buildMessage( $details['i18n-message'], $params,
func_get_args() );
+ return array( $details['i18n-message'], $params );
}
/**
@@ -113,28 +110,5 @@
public function isBundled() {
$details = $this->getActionDetails( $this->getType() );
return isset( $details['bundle'] );
- }
-
- /**
- * Returns i18n message for $msg.
- *
- * Complex parameters can be injected in the i18n messages. Anything in
- * $params will be call_user_func'ed, with these given $arguments.
- * Those results will be used as message parameters.
- *
- * Note: return array( 'raw' => $value ) or array( 'num' => $value ) for
- * raw or numeric parameter input.
- *
- * @param string $msg i18n key
- * @param array[optional] $params Callbacks for parameters
- * @param array[optional] $arguments Arguments for the callbacks
- * @return Message
- */
- protected function buildMessage( $msg, array $params = array(), array
$arguments = array() ) {
- foreach ( $params as &$param ) {
- $param = call_user_func_array( $param, $arguments );
- }
-
- return wfMessage( $msg, $params );
}
}
diff --git a/includes/View/History/HistoryRenderer.php
b/includes/View/History/HistoryRenderer.php
index 788f91b..a22c2ba 100644
--- a/includes/View/History/HistoryRenderer.php
+++ b/includes/View/History/HistoryRenderer.php
@@ -3,13 +3,14 @@
namespace Flow\View\History;
use Flow\Block\Block;
+use Flow\Formatter\AbstractFormatter;
use Flow\Templating;
use MWTimestamp;
/**
* HistoryRenderer will use Templating to render a given list of History.
*/
-class HistoryRenderer {
+class HistoryRenderer extends AbstractFormatter {
/**
* @var Templating
*/
@@ -226,15 +227,21 @@
}
}
- return $this->templating->render( 'flow:history-line.html.php',
array(
- 'class' => $record->getClass(),
- 'message' => $record->getMessage(
+ // build i18n message
+ list( $msg, $params ) = $record->getMessageParams();
+ foreach ( $params as &$param ) {
+ $param = $this->processParam(
// Arguments for the i18n messages' parameter
callbacks.
+ $param,
$record->getData(),
- $this->templating,
$this->block->getWorkflowId(),
$this->block->getName()
- ),
+ );
+ }
+
+ return $this->templating->render( 'flow:history-line.html.php',
array(
+ 'class' => $record->getClass(),
+ 'message' => wfMessage( $msg, $params ),
'timestamp' => $record->getTimestamp(),
'children' => $children,
'historicalLink' => $historicalLink,
--
To view, visit https://gerrit.wikimedia.org/r/113506
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I60e3c16f6f0c1310077fa6a8791bbd380d959e72
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits