User guide advanced modules missing info ?
Hello,
I've been trying the past hours to make appear in the admin panel a list of modules and sub-modules like the blog one.
I've read the "advanced module" in the user guide
(
http://www.getfuelcms.com/user_guide/modules/advanced)
But whatever I did was not enough to make appear my list of modules...
I then made a copy of the entire blog folder and made a search and replace of the word "blog".
I didn't forget to rename all files with the "blog" term inside...
Still no success...
When i finally found someting in a file not mentionned as far as i know (maybe i've been too tired to see it) in the advanced module in the user guide.
\fuel\application\config\MY_fuel.php
$config['modules_allowed'] = array(
'user_guide',
'blog',
'backup',
'seo',
'validate',
'tester',
'cronjobs',
'quiz'
);
Then when i finally added my "quiz" module... Yippi my list of modules appear in the admin in the left menu.
So my question is :
Is it something you forgot to mention, or did i misunderstood something in the user guide ?
Lionel
Comments
Now i have another issue.
When I create a simple module, I can edit my table data via the admin.
I guess FUEL creates automatically forms to edit.
But with advanced module, does fuel to that too ?
/fuel/quiz/categories/edit/0
Gives me a : 404 page not found.
I don't know how exactly but it works now... I can create, edit, delete categories in my module.
Thanks for the cool CMS...
I found another typo in the advanced module guide:
$route[FUEL_ROUTE.'tools/user_guide/:any'] = 'user_guide/$1';
should be:
$route[FUEL_ROUTE.'tools/user_guide/(:any)'] = 'user_guide/$1';
I think a tutorial on how to convert a simple module to an advanced module would be helpful.
Thanks,
Jordan
require_once(INSTALL_ROOT.'/modules/fuel/controllers/module.php'); class Films extends Module { function __construct() { parent::__construct(); } }
Would you recommend this? Seems to be working so far...
I've updated the online user guide to help avoid that confusion as well as to fix the (:any) typo in the route.
Thanks!
A note on my progress...I don't think $CI->load->module_model() is documented, I had to use that instead of $CI->load->model() from some of my other models. And I don't think advanced modules are supported in the foreign_keys variable in Base_module_model. So I had to make an empty simple model that extended my advanced model to get the foreign keys / option dropdown to work. Is there a better way?
Thanks,
Jordan
public $foreign_keys = array('foreign_id' => array('my_module' => 'my_model'));
Also, you should be able to use this syntax as well to load in a model from a different module:
$CI->load->model('my_module/my_model');
I'm having a lot of trouble with custom fields and custom views in my advanced module. I have two questions:
1) How do I create a custom field from the form_fields method? I want to show an image and have radio buttons to choose values associated with it. I tried:
$fields['Test'] = array('type' => 'custom');
but I don't know how to edit the custom field. In my advanced controller I tried overriding the edit() and _form() methods, adding $this->form_builder->create_custom('my_custom_field', $vars); to the _form() method, and adding this method:
function my_custom_field($params) { return "test form data"; }
but I get this error: call_user_func(my_custom_field)]: First argument is expected to be a valid callback.
Also, what am I supposed to send my_custom_field for $params?
2) I'm having trouble loading my own views into the advanced module. I placed a custom view in my module/views folder. I know about $this->load->module_view(); but I am trying to run _render from _edit to replace this function:
$this->_render($this->views['create_edit'], $vars);
I tried something like
$this->_render($this->views['films/views/films_create_edit'], $vars, 'films_model'); but it can't find the file.
Thanks,
Jordan
$form['my_custom_field'] = array('label' => ' My Label', 'type' => 'custom', 'func' => 'my_custom_field');
If your function is a method on an object, you can use:
array($my_obj, 'my_custom_field)
Your function should accept a single array argument and in this case would be passed the $form['my_custom_field'] array.
For the view, try setting a controller property of "view_path" equal to your modules name:
... public $view_location = 'my_module'; ....
$view_path didn't work, and neither did controller property $view_location (which I found in blog/settings), but simply $this->_render('films/films_create_edit', $vars); did.
Thanks,
Jordan
$this->_render('films/films_create_edit', $vars, 'films')