Get sick and tired to work around api changes. Yet another insert tag fix.

This commit is contained in:
David Molineus
2015-08-01 00:16:03 +02:00
parent f8b6563262
commit 8a148ffaf8
2 changed files with 13 additions and 11 deletions

View File

@@ -19,12 +19,19 @@ namespace Netzmacht\Contao\Leaflet\Frontend\Helper;
class FrontendApi extends \Frontend class FrontendApi extends \Frontend
{ {
/** /**
* {@inheritdoc} * Call a Contao method no matter if it's protected.
*
* Inspired by Haste.
*
* @param string $method The method name.
* @param array $arguments The arguments.
*
* @see https://github.com/codefog/contao-haste/commits/master/library/Haste/Haste.php
*
* @return mixed
*/ */
// @codingStandardsIgnoreStart public function call($method, array $arguments = array())
public function replaceInsertTags($strBuffer, $blnCache = true)
{ {
return parent::replaceInsertTags($strBuffer, $blnCache); return call_user_func_array(array($this, $method), $arguments);
} }
// @codingStandardsIgnoreEnd
} }

View File

@@ -28,13 +28,8 @@ class InsertTagReplacer
*/ */
public function replace($buffer, $cache = true) public function replace($buffer, $cache = true)
{ {
if (class_exists('InsertTags')) {
$replacer = new \InsertTags();
return $replacer->replace($buffer, $cache);
}
$frontendApi = new FrontendApi(); $frontendApi = new FrontendApi();
return $frontendApi->replaceInsertTags($buffer, $cache); return $frontendApi->call('replaceInsertTags', array($buffer, $cache));
} }
} }