React on selected layout in pages module

edited August 2015 in Modules
Hi,

I have extendet the page module with 2 fields. Now I want to display the labels according to the selected layout.
Is there a possibility to get the currently selected value in the form_fields method of the my_pages_model? Or is there another method I can overload to save the value in a global var?

Comments

  • I overload form_fields() with function form_fields($values = array()) { $fields = parent::form_fields(); ... } so then I have both fields and values to work with
  • edited 3:37AM
    Hi,

    that doesn't work. I think it is just javascript on changing the layout select value...
  • edited 3:37AM
    The Javascript used for the Pages module is the fuel/modules/fuel/assets/js/fuel/controller/PageController.js file. You could potentially copy that file and make changes to it and then in your MY_fuel_module.php create an overwrite for the "js_controller" and "js_controller_path" parameters:
    http://docs.getfuelcms.com/modules/simple#overwrites
    $config['module_overwrites']['pages']['js_controller'] = 'MyPageController'; $config['module_overwrites']['pages']['js_controller_path'] = js_path();
    This will look for a javascript file in the assets/js/MyPageController.js
  • edited November 2015
    If I may interject, for the array I found that

    $config['module_overwrites']['pages']['js_controller_path'] = BASE_URL.'assets/js/', $config['module_overwrites']['pages']['js_controller'] = 'fuel.controller.MyPageController';
    works better.
    Where the .js file is in /assets/js/fuel/controller.
Sign In or Register to comment.