This feature enables you to display text fields (typically title, username, etc.) as links to the entity page in the admin panel, allowing for detailed viewing of information.
proposed solution, add the renderAsLinkToEntity() method, which will configure the option for displaying
code example:
public function configureFields(string $pageName): iterable
{
return [
IdField::new('id')
->hideOnForm(),
TextField::new('username')
->renderAsLinkToEntity(),
];
}
public function renderAsLinkToEntity(): self
{
return $this->setCustomOption(self::OPTION_RENDER_AS_LINK_TO_ENTITY, true);
}
{% if field.customOptions.get('renderAsLinkToEntity')|default(false) and ea.crud.currentAction == 'index' %}
{% set url = ea_url()
.setAction('detail')
.setEntityId(entity.instance.id)
%}
<a href="{{ url }}" title="{{ field.value }}">{{ field.value }}</a>
{% else %}
{% if ea.crud.currentAction == 'detail' %}
<span title="{{ field.value }}">{{ field.formattedValue|raw|nl2br }}</span>
{% else %}
<span title="{{ field.value }}">{{ field.formattedValue|raw }}</span>
{% endif %}
{% endif %}
I assume that this will only be useful for PAGE_INDEX table views, when it will be possible to go to a detailed view page.
@javiereguiluz If this feature is of interest, I am prepared to assist in its implementation.
This feature enables you to display text fields (typically title, username, etc.) as links to the entity page in the admin panel, allowing for detailed viewing of information.
proposed solution, add the
renderAsLinkToEntity()method, which will configure the option for displayingcode example:
{% if field.customOptions.get('renderAsLinkToEntity')|default(false) and ea.crud.currentAction == 'index' %} {% set url = ea_url() .setAction('detail') .setEntityId(entity.instance.id) %} <a href="{{ url }}" title="{{ field.value }}">{{ field.value }}</a> {% else %} {% if ea.crud.currentAction == 'detail' %} <span title="{{ field.value }}">{{ field.formattedValue|raw|nl2br }}</span> {% else %} <span title="{{ field.value }}">{{ field.formattedValue|raw }}</span> {% endif %} {% endif %}I assume that this will only be useful for
PAGE_INDEXtable views, when it will be possible to go to a detailed view page.@javiereguiluz If this feature is of interest, I am prepared to assist in its implementation.