You are here

public static function ElevateZoomPlus::create in ElevateZoom Plus 7

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.

Overrides SlickBase::create

1 call to ElevateZoomPlus::create()
elevatezoomplus_elevatezoomplus_optionsets in ./elevatezoomplus.elevatezoomplus_optionset.inc
Implements hook_elevatezoomplus_optionsets().

File

src/Entity/ElevateZoomPlus.php, line 20

Class

ElevateZoomPlus
Defines the ElevateZoomPlus configuration entity.

Namespace

Drupal\elevatezoomplus\Entity

Code

public static function create(array $values = []) {
  ctools_include('export');
  $optionset = ctools_export_crud_new(static::TABLE);
  $optionset->options = $optionset->options['settings'] = [];
  foreach (self::defaultProperties() as $key => $ignore) {
    if (isset($values[$key])) {
      $optionset->{$key} = $values[$key];
    }
  }
  if (empty($values['label']) && isset($values['name'])) {
    $optionset->label = $values['name'];
  }
  $defaults['settings'] = self::defaultSettings();
  $optionset->options = $optionset->options + $defaults;
  return $optionset;
}