public static function SlickBase::create in Slick Carousel 7.3
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 SlickBaseInterface::create
File
- src/
Entity/ SlickBase.php, line 109
Class
- SlickBase
- Defines the Slick configuration entity.
Namespace
Drupal\slick\EntityCode
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;
}