SonataAdmin: replace ID in breadcrumbs

半世苍凉 提交于 2019-12-01 04:11:41
TautrimasPajarskas

This behaviour is implemented directly in the entity:

public function __toString()
{
    return $this->getFoo() ? : '-';
}

Bundles are using variants of this, including return (string)$this->getFoo(); or $this->getFoo() ? : 'n/a'; etc.

Related question: toString method for SonataAdminBundle Listing in Symfony2

BTW something cool to know, you can completely customize the breadcrumb via a Twig template:

{% block sonata_breadcrumb %}

    {% set _breadcrumb %}
        <li><a href="#">Home</a></li>
        <li><a href="#">Library</a></li>
        <li class="active">Data</li>
    {% endset %}

    {{ parent() }}

{% endblock %}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!