|
@@ -65,31 +65,15 @@ class SonataAdminExtension extends \Twig_Extension
|
|
public function getFilters()
|
|
public function getFilters()
|
|
{
|
|
{
|
|
return array(
|
|
return array(
|
|
- 'render_list_element' => new \Twig_Filter_Method($this, 'renderListElement', array('is_safe' => array('html'))),
|
|
|
|
- 'render_view_element' => new \Twig_Filter_Method($this, 'renderViewElement', array('is_safe' => array('html'))),
|
|
|
|
- 'render_view_element_compare' => new \Twig_Filter_Method($this, 'renderViewElementCompare', array('is_safe' => array('html'))),
|
|
|
|
- 'render_relation_element' => new \Twig_Filter_Method($this, 'renderRelationElement'),
|
|
|
|
- 'sonata_urlsafeid' => new \Twig_Filter_Method($this, 'getUrlsafeIdentifier'),
|
|
|
|
- 'sonata_xeditable_type' => new \Twig_Filter_Method($this, 'getXEditableType'),
|
|
|
|
|
|
+ new \Twig_SimpleFilter('render_list_element', array($this, 'renderListElement'), array('is_safe' => array('html'))),
|
|
|
|
+ new \Twig_SimpleFilter('render_view_element', array($this, 'renderViewElement'), array('is_safe' => array('html'))),
|
|
|
|
+ new \Twig_SimpleFilter('render_view_element_compare', array($this, 'renderViewElementCompare'), array('is_safe' => array('html'))),
|
|
|
|
+ new \Twig_SimpleFilter('render_relation_element', array($this, 'renderRelationElement')),
|
|
|
|
+ new \Twig_SimpleFilter('sonata_urlsafeid', array($this, 'getUrlsafeIdentifier')),
|
|
|
|
+ new \Twig_SimpleFilter('sonata_xeditable_type', array($this, 'getXEditableType')),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * {@inheritdoc}
|
|
|
|
- */
|
|
|
|
- public function getFunctions()
|
|
|
|
- {
|
|
|
|
- return array();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * {@inheritdoc}
|
|
|
|
- */
|
|
|
|
- public function getTokenParsers()
|
|
|
|
- {
|
|
|
|
- return array();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* {@inheritdoc}
|
|
* {@inheritdoc}
|
|
*/
|
|
*/
|
|
@@ -104,7 +88,7 @@ class SonataAdminExtension extends \Twig_Extension
|
|
* @param FieldDescriptionInterface $fieldDescription
|
|
* @param FieldDescriptionInterface $fieldDescription
|
|
* @param string $defaultTemplate
|
|
* @param string $defaultTemplate
|
|
*
|
|
*
|
|
- * @return \Twig_TemplateInterface
|
|
|
|
|
|
+ * @return \Twig_Template
|
|
*/
|
|
*/
|
|
protected function getTemplate(FieldDescriptionInterface $fieldDescription, $defaultTemplate)
|
|
protected function getTemplate(FieldDescriptionInterface $fieldDescription, $defaultTemplate)
|
|
{
|
|
{
|
|
@@ -146,12 +130,12 @@ class SonataAdminExtension extends \Twig_Extension
|
|
|
|
|
|
/**
|
|
/**
|
|
* @param FieldDescriptionInterface $fieldDescription
|
|
* @param FieldDescriptionInterface $fieldDescription
|
|
- * @param \Twig_TemplateInterface $template
|
|
|
|
|
|
+ * @param \Twig_Template $template
|
|
* @param array $parameters
|
|
* @param array $parameters
|
|
*
|
|
*
|
|
* @return string
|
|
* @return string
|
|
*/
|
|
*/
|
|
- public function output(FieldDescriptionInterface $fieldDescription, \Twig_TemplateInterface $template, array $parameters = array())
|
|
|
|
|
|
+ public function output(FieldDescriptionInterface $fieldDescription, \Twig_Template $template, array $parameters = array())
|
|
{
|
|
{
|
|
$content = $template->render($parameters);
|
|
$content = $template->render($parameters);
|
|
|
|
|
|
@@ -323,9 +307,7 @@ class SonataAdminExtension extends \Twig_Extension
|
|
public function getUrlsafeIdentifier($model, AdminInterface $admin = null)
|
|
public function getUrlsafeIdentifier($model, AdminInterface $admin = null)
|
|
{
|
|
{
|
|
if (is_null($admin)) {
|
|
if (is_null($admin)) {
|
|
- $admin = $this->pool->getAdminByClass(
|
|
|
|
- ClassUtils::getClass($model)
|
|
|
|
- );
|
|
|
|
|
|
+ $admin = $this->pool->getAdminByClass(ClassUtils::getClass($model));
|
|
}
|
|
}
|
|
|
|
|
|
return $admin->getUrlsafeIdentifier($model);
|
|
return $admin->getUrlsafeIdentifier($model);
|