You are here

function slick_optionset_create in Slick Carousel 7.2

Same name and namespace in other branches
  1. 7.3 slick.deprecated.inc \slick_optionset_create()

Returns a new optionset object without saving it to the database.

Parameters

array $values: The values to build the optionset if provided.

Return value

object Returns the programmatically created optionset object.

2 calls to slick_optionset_create()
SlickTestCase::testOptionSetCrud in tests/slick.test
Tests Slick optionset CRUD.
slick_slick_default_presets in ./slick.slick_default_preset.inc
Implements hook_slick_default_presets().

File

./slick.module, line 258
Slick carousel integration, the last carousel you'll ever need.

Code

function slick_optionset_create(array $values = array()) {
  ctools_include('export');
  $optionset = ctools_export_crud_new('slick_optionset');
  $optionset->options = $optionset->options['settings'] = array();
  $optionset->breakpoints = 0;
  foreach (array(
    'name',
    'label',
    'skin',
    'breakpoints',
    'options',
  ) as $key) {
    if (isset($values[$key])) {
      $optionset->{$key} = $values[$key];
    }
  }
  $defaults['general'] = array(
    'goodies' => array(),
  );
  $defaults['settings'] = slick_get_options();
  $optionset->options = $optionset->options + $defaults;
  return $optionset;
}