1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/11768] Added configurator events

PHPBB3-11768
This commit is contained in:
JoshyPHP
2015-03-19 12:45:12 +01:00
parent f4f5bdbaee
commit 49b9e8e4ea
4 changed files with 84 additions and 4 deletions

View File

@@ -100,23 +100,29 @@ class factory implements \phpbb\textformatter\cache_interface
'email' => '<a href="mailto:{EMAIL}"><xsl:apply-templates/></a>',
);
/**
* @var \phpbb\event\dispatcher_interface
*/
protected $dispatcher;
/**
* Constructor
*
* @param \phpbb\textformatter\data_access $data_access
* @param \phpbb\cache\driver\driver_interface $cache
* @param \phpbb\event\dispatcher_interface $dispatcher
* @param string $cache_dir Path to the cache dir
* @param string $cache_key_parser Cache key used for the parser
* @param string $cache_key_renderer Cache key used for the renderer
*/
public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, $cache_dir, $cache_key_parser, $cache_key_renderer)
public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, $cache_dir, $cache_key_parser, $cache_key_renderer)
{
$this->cache = $cache;
$this->cache_dir = $cache_dir;
$this->cache_key_parser = $cache_key_parser;
$this->cache_key_renderer = $cache_key_renderer;
$this->data_access = $data_access;
$this->dispatcher = $dispatcher;
}
/**
@@ -158,6 +164,16 @@ class factory implements \phpbb\textformatter\cache_interface
// Create a new Configurator
$configurator = new Configurator;
/**
* Modify the s9e\TextFormatter configurator before the default settings are set
*
* @event core.text_formatter_s9e_configure_before
* @var \s9e\TextFormatter\Configurator configurator Configurator instance
* @since 3.2.0-a1
*/
$vars = array('configurator');
extract($this->dispatcher->trigger_event('core.text_formatter_s9e_configure_before', compact($vars)));
// Convert newlines to br elements by default
$configurator->rootRules->enableAutoLineBreaks();
@@ -288,6 +304,16 @@ class factory implements \phpbb\textformatter\cache_interface
$configurator->registeredVars['max_img_height'] = 0;
$configurator->registeredVars['max_img_width'] = 0;
/**
* Modify the s9e\TextFormatter configurator after the default settings are set
*
* @event core.text_formatter_s9e_configure_after
* @var \s9e\TextFormatter\Configurator configurator Configurator instance
* @since 3.2.0-a1
*/
$vars = array('configurator');
extract($this->dispatcher->trigger_event('core.text_formatter_s9e_configure_after', compact($vars)));
return $configurator;
}