protected function FivestarWidgetBase::getSelectedWidgetKey in Fivestar 8
Gets the selected widget key.
Sites that used an older version of the module will have a stale key set for their selected widget. This returns the proper, cleaned up version if that's the case.
Return value
string The active widget's key
3 calls to FivestarWidgetBase::getSelectedWidgetKey()
- StarsWidget::formElement in src/
Plugin/ Field/ FieldWidget/ StarsWidget.php - Returns the form for a single field widget.
- StarsWidget::settingsForm in src/
Plugin/ Field/ FieldWidget/ StarsWidget.php - Returns a form to configure settings for the widget.
- StarsWidget::settingsSummary in src/
Plugin/ Field/ FieldWidget/ StarsWidget.php - Returns a short summary for the current widget settings.
File
- src/
Plugin/ Field/ FieldWidget/ FivestarWidgetBase.php, line 67
Class
- FivestarWidgetBase
- Base class for Fivestar field widgets.
Namespace
Drupal\fivestar\Plugin\Field\FieldWidgetCode
protected function getSelectedWidgetKey() {
$setting = $this
->getSetting('fivestar_widget') ?: 'default';
if (strpos($setting, '.css') === FALSE) {
return $setting;
}
$file_name = basename($setting);
$file_name_exploded = explode('.', $file_name);
$setting = reset($file_name_exploded);
return $setting;
}