deblan.tv/vendor/trinity/src/Trinity/Bundle/ContentManagerBundle/Block/ObjectBlock.php
2015-03-02 21:57:49 +01:00

33 lines
716 B
PHP

<?php
namespace Trinity\Bundle\ContentManagerBundle\Block;
use Trinity\Bundle\ContentManagerBundle\Model\Block;
class ObjectBlock extends Block
{
const DEFAULT_TEMPLATE = 'TrinityContentManagerBundle:Block:block_title.html.twig';
public function getTemplate()
{
if ($this->template == null) {
return $this::DEFAULT_TEMPLATE;
}
return $this->template;
}
public function getValue($object = false)
{
if ($object) {
$data = explode(':',parent::getValue());
$class_peer = $data[0].'Peer';
$pk = $data[1];
return $class_peer::retrieveByPk($pk);
}
return parent::getValue();
}
}