[SOLVED]How to remove hyperlink from scaffolding generated code baked by cakephp (cakephp 3.50)

current code:

<?= $user->has('user_role') ? $this->Html->link($user->user_role->role, [$user->user_role->id]) : '' ?>

I want the same result as above but without hyperlinking the associated value.

Out of curiousity, what is this code supposed to do? I see a “?” in there that I cannot place and I don’t understand where the final colon and quotes come from. I have tried it and it crated a hyperlink to a user role with id “id” on the name of a user role. It looks like <?php echo IF?TRUE_CONDITION : FALSE_CONDITION ?> to me. Is that it?

hi,
this line creates a hyperlinked value of an associated field(from a lookup table). it was generated by cakephp when baking the table. However, i was able to find a solution to remove hyperlinking the associated value, here it it is below:

<?= $user->has('user_role') ? ($user->user_role->role) : '' ?>

thanks for viewing and replying .