function royalslider_optionset_options in RoyalSlider Integration 8
Gets an array of optionsets suitable for using as select list options.
Parameters
$include_empty: If TRUE a '- None -' option will be inserted in the options array.
Return value
Array of optionsets both key and value are set to optionset name.
2 calls to royalslider_optionset_options()
- RoyalSliderFormatter::settingsForm in src/
Plugin/ Field/ FieldFormatter/ RoyalSliderFormatter.php - Returns a form to configure settings for the formatter.
- RoyalSliderFormatter::settingsSummary in src/
Plugin/ Field/ FieldFormatter/ RoyalSliderFormatter.php - Returns a short summary for the current formatter settings.
File
- ./
royalslider.module, line 28 - Exposes global functionality for using RoyalSlider on your website.
Code
function royalslider_optionset_options($include_empty = TRUE) {
$optionsets = entity_load_multiple('royalslider_optionset');
$options = array();
if ($include_empty && !empty($optionsets)) {
$options[''] = t('- None -');
}
foreach ($optionsets as $name => $optionset) {
$options[$name] = $optionset
->label();
}
if (empty($options)) {
$options[''] = t('No defined optionsets');
}
return $options;
}