Welcome Guest, Not a member yet? Register   Sign In
CI Bonfire - adding search/filter/sort on code generated admin screens
#1

Does anyone know of an easy way to add a search, filter and column sort to code generated admin screens in a Bonfire project?

I can do it easy enough manually but wondered if anyone had either a) already done this or b) could suggest the most reusable way of going about it.
Reply
#2

If you are taking a JavaScript-based approach to adding search/filter/sort code, you could potentially add the required assets in your base controller(s) instead, and avoid dealing with the builder at all.

Otherwise, this really depends on the code you want to add, and whether you want to add this code all the time or conditionally (and whether you want to modify the builder to control whether the code is added).

The most straight-forward thing to do is to add the code all the time with no controls. In most cases, this means modifying the controller and possibly the index view. So, you would copy the following files:
/bonfire/modules/builder/views/files/controller.php
/bonfire/modules/builder/views/files/view_index.php

Place the copies of these files into the following locations:
/application/modules/builder/views/files/controller.php
/application/modules/builder/views/files/view_index.php

The easiest place to make changes is in the template at the very end of each file. Change the copy (in the application directory) rather than the original. The Bonfire loader should load the file from your application directory if it's available, but if you want to revert to Bonfire's version you can just remove/rename the file in your application directory.

In fact, when I'm considering modifying a Bonfire module, I usually start by copying the whole module over to my application directory, then I make/test my changes in the application, so I can always just remove the module from my application if I want to go back to the original version.

The process is pretty similar as your requirements get more complex, but modifying the builder itself rather than just the output templates requires touching a few more files.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB