forked from Snck3rs/contao-leaflet-maps
Code style.
This commit is contained in:
@@ -21,8 +21,10 @@ class FrontendApi extends \Frontend
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
public function replaceInsertTags($strBuffer, $blnCache = true)
|
public function replaceInsertTags($strBuffer, $blnCache = true)
|
||||||
{
|
{
|
||||||
return parent::replaceInsertTags($strBuffer, $blnCache);
|
return parent::replaceInsertTags($strBuffer, $blnCache);
|
||||||
}
|
}
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class ValueFilter
|
|||||||
* The idea behind this extra method is that we just have to change one place if anything else than the
|
* 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.
|
* insert tags has to be replaced.
|
||||||
*
|
*
|
||||||
* @param string $value The given value
|
* @param string $value The given value.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ abstract class AbstractMapper implements Mapper
|
|||||||
protected static $definitionClass = null;
|
protected static $definitionClass = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options builder
|
* Options builder.
|
||||||
*
|
*
|
||||||
* @var OptionsBuilder
|
* @var OptionsBuilder
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ class DefinitionMapper
|
|||||||
* @param mixed $model The data model.
|
* @param mixed $model The data model.
|
||||||
*
|
*
|
||||||
* @return Mapper
|
* @return Mapper
|
||||||
|
* @throws \RuntimeException If the mapper could not be found.
|
||||||
*/
|
*/
|
||||||
private function getMapper($model)
|
private function getMapper($model)
|
||||||
{
|
{
|
||||||
@@ -178,7 +179,7 @@ class DefinitionMapper
|
|||||||
|
|
||||||
throw new \RuntimeException(
|
throw new \RuntimeException(
|
||||||
sprintf(
|
sprintf(
|
||||||
'Could not build model "". No matching mappers found.',
|
'Could not build model "%s". No matching mappers found.',
|
||||||
$this->hash($model)
|
$this->hash($model)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
if ($model->pointToLayer || $model->affectBounds) {
|
if ($model->pointToLayer || $model->affectBounds) {
|
||||||
$layer = new GeoJson($this->getElementId($model, $elementId));
|
$layer = new GeoJson($this->getElementId($model, $elementId));
|
||||||
|
|
||||||
if ($model->pointToLayer ) {
|
if ($model->pointToLayer) {
|
||||||
$layer->setPointToLayer(new Expression($model->pointToLayer));
|
$layer->setPointToLayer(new Expression($model->pointToLayer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,10 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
) {
|
) {
|
||||||
if ($definition instanceof GeoJson) {
|
if ($definition instanceof GeoJson) {
|
||||||
$collection = $this->loadVectorModels($model);
|
$collection = $this->loadVectorModels($model);
|
||||||
$definition->setOption('affectBounds', (bool) $model->affectBounds);
|
|
||||||
|
if ($model->affectBounds) {
|
||||||
|
$definition->setOption('affectBounds', true);
|
||||||
|
}
|
||||||
|
|
||||||
if ($collection) {
|
if ($collection) {
|
||||||
foreach ($collection as $item) {
|
foreach ($collection as $item) {
|
||||||
@@ -120,13 +123,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($model->pointToLayer) {
|
$this->addCallbacks($definition, $model);
|
||||||
$definition->setPointToLayer(new Expression($model->pointToLayer));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($model->onEachFeature) {
|
|
||||||
$definition->setOnEachFeature(new Expression($model->onEachFeature));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,4 +167,23 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
{
|
{
|
||||||
return VectorModel::findActiveBy('pid', $model->id, array('order' => 'sorting'));
|
return VectorModel::findActiveBy('pid', $model->id, array('order' => 'sorting'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add javascript callbacks.
|
||||||
|
*
|
||||||
|
* @param GeoJson $definition The definition.
|
||||||
|
* @param \Model $model The database model.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function addCallbacks(GeoJson $definition, \Model $model)
|
||||||
|
{
|
||||||
|
if ($model->pointToLayer) {
|
||||||
|
$definition->setPointToLayer(new Expression($model->pointToLayer));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($model->onEachFeature) {
|
||||||
|
$definition->setOnEachFeature(new Expression($model->onEachFeature));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Netzmacht\Contao\Leaflet;
|
|||||||
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
|
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ServiceContainer
|
* Class ServiceContainer provides the services which are available for Contao leaflet.
|
||||||
*
|
*
|
||||||
* @package Netzmacht\Contao\Leaflet
|
* @package Netzmacht\Contao\Leaflet
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ trait ServiceContainerTrait
|
|||||||
* Get the service container.
|
* Get the service container.
|
||||||
*
|
*
|
||||||
* @return ServiceContainer
|
* @return ServiceContainer
|
||||||
|
* @SuppressWarnings(PHPMD.Superglobals)
|
||||||
*/
|
*/
|
||||||
protected function getServiceContainer()
|
protected function getServiceContainer()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class HashSubscriber implements EventSubscriberInterface
|
|||||||
$data = $event->getData();
|
$data = $event->getData();
|
||||||
|
|
||||||
if ($data instanceof \Model) {
|
if ($data instanceof \Model) {
|
||||||
$event->setHash($data->getTable() . '.' . $data->{$data->getPk()});
|
$event->setHash($data->getTable() . '::' . $data->{$data->getPk()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user