Improve backend content element handling.

This commit is contained in:
David Molineus
2015-01-07 11:13:15 +01:00
parent 84ede62132
commit 9e1c8499f2
3 changed files with 60 additions and 1 deletions

View File

@@ -11,6 +11,9 @@
namespace Netzmacht\Contao\Leaflet;
use Netzmacht\Contao\Leaflet\Mapper\MapMapper;
use Netzmacht\Contao\Leaflet\Model\MapModel;
/**
* @property int leaflet_map
*/
@@ -41,6 +44,29 @@ class LeafletMapElement extends \ContentElement
$this->mapService = $GLOBALS['container']['leaflet.map.service'];
}
public function generate()
{
if (TL_MODE === 'BE') {
$model = MapModel::findByPK($this->leaflet_map);
$template = new \BackendTemplate('be_wildcard');
if ($model) {
$href = 'contao/main.php?do=leaflet&table=tl_leaflet_map&act=edit&id=' . $model->id;
$template->wildcard = '### LEAFLET MAP ' . $model->title . ' ###';
$template->title = $this->headline;
$template->id = $model->id;
$template->link = $model->title;
$template->href = $href;
}
return $template->parse();
}
return parent::generate();
}
/**
* Compile the content element.
*