FUEL CMS 1.2 Released


FUEL CMS 1.2 is out and ready for download. Unlike the 1.1 release, which mostly included an upgrade to the latest CodeIgniter version, FUEL CMS 1.2 provides a number of feature enhancements and bug fixes. The release notes have a more complete list, but I wanted to highlight some of the bigger improvements.

New Field Types

With this release comes three new field types added to the core: colorpicker, toggler, and dependent.

Colorpicker

We have written about adding a custom colorpicker field type before, but we decided it was such an important field type that it should be included in the core.

Toggler

The toggler field type adds the ability for a select or radio field (an enum field type) to toggle on and off the visibility of other fields. This is done by adding classes to fields that should toggle on and off. Below is an example. Note that the selected value of the toggler_example field is used in conjunction with the prefix parameter which is set to toggle_. When the toggler_example select or radio value is set to 1, toggler_field1 will appear and toggler_field2 will be hidden. When 2 is the value, the opposite happens.

$fields['toggler_example'] = array('type' => 'toggler', 'prefix' => 'toggle_', 'options' => array('1' => 'One', '2' => 'Two'));
$fields['toggler_field1'] = array('class' => 'toggle toggle_1');
$fields['toggler_field2'] = array('type' => 'select', 'class' => 'toggle toggle_2'));

Dependent

The dependent field type is a dropdown select in which its values are dynamically determined by another select field. Say for example, you have a simple locations module which includes a form that has a dropdown select of cities. When a city is selected, you want another dropdown select to dynamically change to show the zip codes of the selected city. By default, the selection of a city will trigger an AJAX request to the url of locations/ajax/options and will send GET parameters that include city=[selected_city]. These GET parameters then get passed as where conditions to the locations_model’s ajax_options method (which is a new method as of 1.2). This method is inherited from the Base_module_model and can be overwritten for your needs.

Remember that methods on your model that have names beginning with ajax_ will automatically be exposed via the module controller. So if the default AJAX URL wasn’t what you want and instead want to create a custom method that returns the zip codes, you could change the url parameter and subsequently create a method name of ajax_zips to do just that. After the AJAX request, the select options will be replaced.

$fields['cities'] = array('type' => 'select', 'model' => 'cities_model');
$fields['zip_codes'] = array('type' => 'dependent', 'depends_on' => 'city', 'url' => fuel_url('locations/ajax/zips'), 'multiple' => FALSE);
public function ajax_zips($where = array())
{
	$CI =& get_instance();
	$CI->load->model('zips_model');
	$options = $CI->zips_model->options_list(NULL, NULL, $where);
	$str = '';
	foreach($options as $key => $val)
	{
		$str .= "\n";
	}
	return $str;
}

There is a replace_selector parameter which can be used to target elements whose content you want to replace. So theoretically, the method could return any HTML you want and it will replace whatever HTML is contained in the replace_selector element.

Database Updates

The MySQL database storage engine has been changed from MySAM to InnoDB to bring it inline with the default settings of MySQL. When FUEL was initially developed, MySAM was the default but since MySQL 5.5, the default was changed to InnoDB.

In addition, the MySQLi CodeIgniter driver has been modified to work with FUEL CMS. This means you can change your database driver in the fuel/application/config/database.php to the following:

$db['default']['dbdriver'] = 'mysqli';

CKEditor Updates

For those that like to use the CKEditor for editing large blocks of text, you’ll be happy to know it’s received a bit of attention as well. In addition to several integration bug fixes, CKEditor itself has been upgraded to version 4.4.4.

Miscellaneous Updates

  • You can create a preview_path method on a module’s model for better control of dynamic parameters when creating a module URI.
  • You can now assign layouts to multiple groups which can help when setting the group parameter on a “block” field type.
  • Updated the google_helper to support the new universal analytics code.
  • Block layouts in modules other then the pages module should work more consistently.

What’s Next

We have a couple of advanced modules in the works and one very close to being released which will make front-end form developing a breeze. Stay tuned.


Comments

Awesome! I looked for instructions how to upgrade an existing 1.1. installation but did not find anything.

What is best practice here?

Felix, Aug 27, 2014

I’d recommend setting up your projects using GIT and pulling from the remote repo at https://github.com/daylightstudio/FUEL-CMS/.

Then going forward you can just do a pull from the master branch and it will merge in the changes and warn you if there are any conflicts.

If you just downloaded the zip folder you should be OK replacing the fuel/modules/fuel folder and replacing the value of the ck_editor_settings
in fuel/application/config/MY_fuel.php

David McReynolds, Aug 27, 2014

Comments have been turned off for this post.


  Back to Top