Customize admin dashboard for custom module...

edited June 2012 in Modules
I'm working on a custom module that utilizes events and shifts. Rather than use fuel's foreign key implementation, I'd like to pull in all of the shifts associated with an event using my own function; I need to do some javascript magic as well as basic formatting. As such, I need to create a fieldset or div for each shift. The (here abbreviated) code from my model which pulls in the needed data and generates the additional form fields is below:

function form_fields($values) { $data = parent::form_fields($values); $shifts = $this->get_shifts($values['id']); $i = 1; foreach($shifts as $shift) { $this->load->library('form_builder', array('fieldset' => "shift-$i")); $data["Shift $i Start"] = array('required' => TRUE, 'value' => $shift['shift_start_time'], 'class' => 'myClass'); $data["Shift $i End"] = array('required' => TRUE, 'value' => $shift['shift_end_time'], 'class' => 'myClass'); $data["Shift $i Volunteer"] = array('required' => TRUE, 'type' => 'select', 'options' => $this->get_vols()); $i++; } return $data; }

I'm not sure how to wrap these fields in a div or fieldset... As it stands, the formbuilder is building this form as a table... Is it possible to reconfigure this behavior, and if so where? (ie - where is this form_fields() data being handed off to the form builder? I assume that if I override the configuration options there that I can reconfigure the form-builder and get what I want...)

Any help appreciated.

Comments

  • edited June 2012
    You can create a field type of "custom" which you can pass it a "func" parameter that refers to a function or class/method:
    $fields['shifts'] = array('type' => 'custom', 'func' => 'my_func'); // or using a class/method $fields['shifts'] = array('type' => 'custom', 'func' => array('my_class', 'my_func'));
    The function or class/method should contain the rendering logic for your shifts.
  • edited June 2012
    Actually, I realized (with google's help) that I'd asked this question already, before I set this project aside for an extended period. Lance's handy response can be found below:

    http://www.getfuelcms.com/forums/discussion/709/extend-admin-module-edit-page/p1
Sign In or Register to comment.