You are here

function royalslider_optionset_create in RoyalSlider Integration 7

Create a new optionset object

Note that this function does not save the optionset to the database.

See also

royalslider_optionset_save()

3 calls to royalslider_optionset_create()
royalslider_form_optionset_add_submit in ./royalslider.admin.inc
Submit handler for adding a new option set.
royalslider_form_optionset_edit in ./royalslider.admin.inc
Form builder; Form to edit a given option set.
royalslider_royalslider_default_presets in ./royalslider.royalslider_default_preset.inc
Implements hook_royalslider_default_presets().

File

./royalslider.module, line 151
RoyalSlider module.

Code

function royalslider_optionset_create($values = array()) {
  ctools_include('export');
  $optionset = ctools_export_crud_new('royalslider_optionset');

  // Set the options to an array
  $optionset->options = array();

  // Assign specified values
  if (isset($values['name'])) {
    $optionset->name = $values['name'];
  }
  if (isset($values['title'])) {
    $optionset->title = $values['title'];
  }
  if (isset($values['skin'])) {
    $optionset->skin = $values['skin'];
  }
  if (isset($values['imagestyle_fullscreen'])) {
    $optionset->imagestyle_fullscreen = $values['imagestyle_fullscreen'];
  }
  if (isset($values['imagestyle_normal'])) {
    $optionset->imagestyle_normal = $values['imagestyle_normal'];
  }
  if (isset($values['imagestyle_thumbnail'])) {
    $optionset->imagestyle_thumbnail = $values['imagestyle_thumbnail'];
  }
  if (isset($values['options']) and is_array($values['options'])) {
    $optionset->options = $values['options'];
  }

  // Merge default settings with any given settings
  $optionset_defaults = _royalslider_optionset_defaults();
  $optionset->options = $optionset_defaults += $optionset->options;
  return $optionset;
}