Allow extensions to specify the list of special parameters

This commit is contained in:
Joas Schilling 2014-12-11 14:54:50 +01:00
parent b33d8a3d60
commit 1b18554aa7
3 changed files with 39 additions and 0 deletions

View File

@ -167,6 +167,25 @@ class ActivityManager implements IManager {
return false;
}
/**
* @param string $app
* @param string $text
* @return array|false
*/
function getSpecialParameterList($app, $text) {
foreach($this->extensions as $extension) {
$c = $extension();
if ($c instanceof IExtension) {
$specialParameter = $c->getSpecialParameterList($app, $text);
if (is_array($specialParameter)) {
return $specialParameter;
}
}
}
return false;
}
/**
* @param string $type
* @return string

View File

@ -79,6 +79,19 @@ interface IExtension {
*/
public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
/**
* The extension can define the type of parameters for translation
*
* Currently known types are:
* * file => will strip away the path of the file and add a tooltip with it
* * username => will add the avatar of the user
*
* @param string $app
* @param string $text
* @return array|false
*/
function getSpecialParameterList($app, $text);
/**
* A string naming the css class for the icon to be used can be returned.
* If no icon is known for the given type false is to be returned.

View File

@ -99,6 +99,13 @@ interface IManager {
*/
function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
/**
* @param string $app
* @param string $text
* @return array|false
*/
function getSpecialParameterList($app, $text);
/**
* @param string $type
* @return string