Replace insert tags and masked entities. (Fix #17)

This commit is contained in:
David Molineus
2015-01-22 12:24:22 +01:00
parent b65bcbff9f
commit 9dfb6698cf
7 changed files with 202 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2015 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Frontend\Helper;
/**
* Class FrontendApi provides access to the frontend api of contao.
*
* @package Netzmacht\Contao\Leaflet\Frontend\Helper
*/
class FrontendApi extends \Frontend
{
/**
* {@inheritdoc}
*/
public function replaceInsertTags($strBuffer, $blnCache = true)
{
return parent::replaceInsertTags($strBuffer, $blnCache);
}
}

View File

@@ -0,0 +1,54 @@
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2015 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Frontend;
use Netzmacht\Contao\Leaflet\Frontend\Helper\FrontendApi;
/**
* Class ValueFilter is a service class which can be used to filter values before passing them to an definition object.
*
* @package Netzmacht\Contao\Leaflet\Frontend
*/
class ValueFilter
{
/**
* The frontend api of Contao.
*
* @var FrontendApi
*/
private $api;
/**
* Construct.
*
* @param FrontendApi $api The frontend api of Contao.
*/
public function __construct($api)
{
$this->api = $api;
}
/**
* Filter a value so it can be passed to the frontend.
*
* The idea behind this extra method is that we just have to change one place if anything else than the
* insert tags has to be replaced.
*
* @param string $value The given value
*
* @return string
*/
public function filter($value)
{
return $this->api->replaceInsertTags($value);
}
}