diff --git a/src/Netzmacht/Contao/Leaflet/Frontend/Helper/FrontendApi.php b/src/Netzmacht/Contao/Leaflet/Frontend/Helper/FrontendApi.php index b6919a7..32322e4 100644 --- a/src/Netzmacht/Contao/Leaflet/Frontend/Helper/FrontendApi.php +++ b/src/Netzmacht/Contao/Leaflet/Frontend/Helper/FrontendApi.php @@ -19,12 +19,19 @@ namespace Netzmacht\Contao\Leaflet\Frontend\Helper; 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 replaceInsertTags($strBuffer, $blnCache = true) + public function call($method, array $arguments = array()) { - return parent::replaceInsertTags($strBuffer, $blnCache); + return call_user_func_array(array($this, $method), $arguments); } - // @codingStandardsIgnoreEnd } diff --git a/src/Netzmacht/Contao/Leaflet/Frontend/Helper/InsertTagReplacer.php b/src/Netzmacht/Contao/Leaflet/Frontend/Helper/InsertTagReplacer.php index b07b07e..0774c8f 100644 --- a/src/Netzmacht/Contao/Leaflet/Frontend/Helper/InsertTagReplacer.php +++ b/src/Netzmacht/Contao/Leaflet/Frontend/Helper/InsertTagReplacer.php @@ -28,13 +28,8 @@ class InsertTagReplacer */ public function replace($buffer, $cache = true) { - if (class_exists('InsertTags')) { - $replacer = new \InsertTags(); - return $replacer->replace($buffer, $cache); - } - $frontendApi = new FrontendApi(); - return $frontendApi->replaceInsertTags($buffer, $cache); + return $frontendApi->call('replaceInsertTags', array($buffer, $cache)); } }