I have a couple of pages where I allow users to soft delete and restore records (the SoftDeleteTrait works very well here).
I also allow users to [show | hide] deleted records. There are two separate actions that drive which to show, /index and /all. At first I also had two separate templates,
In an effort to consolidate, I got rid of
all.ctp and added some if/else clauses to
index.ctp to toggle whether to display the “Show Deleted” and “Hide Deleted” links. I also modified the /all action in the controller to render
This is where my question comes in: is what I did bad practice? I feel clauses like
<?php if ($this->request->getParam('action') == 'all'): ?>
in a template file is dirty. What’s the consensus on this?