diff -u b/core/modules/options/lib/Drupal/options/Plugin/field/widget/ButtonsWidget.php b/core/modules/options/lib/Drupal/options/Plugin/field/widget/ButtonsWidget.php --- b/core/modules/options/lib/Drupal/options/Plugin/field/widget/ButtonsWidget.php +++ b/core/modules/options/lib/Drupal/options/Plugin/field/widget/ButtonsWidget.php @@ -69,7 +69,7 @@ */ protected function getEmptyOption() { if (!$this->required && !$this->multiple) { - return self::OPTIONS_EMPTY_NONE; + return static::OPTIONS_EMPTY_NONE; } } diff -u b/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php b/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php --- b/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php +++ b/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php @@ -199,7 +199,7 @@ * Returns the empty option to add to the list of options, if any. * * @return string|null - * Either self::OPTIONS_EMPTY_NONE, self::OPTIONS_EMPTY_SELECT, or NULL. + * Either static::OPTIONS_EMPTY_NONE, static::OPTIONS_EMPTY_SELECT, or NULL. */ protected function getEmptyOption() { } diff -u b/core/modules/options/lib/Drupal/options/Plugin/field/widget/SelectWidget.php b/core/modules/options/lib/Drupal/options/Plugin/field/widget/SelectWidget.php --- b/core/modules/options/lib/Drupal/options/Plugin/field/widget/SelectWidget.php +++ b/core/modules/options/lib/Drupal/options/Plugin/field/widget/SelectWidget.php @@ -66,7 +66,7 @@ if ($this->multiple) { // Multiple select: add a 'none' option for non-required fields. if (!$this->required) { - return self::OPTIONS_EMPTY_NONE; + return static::OPTIONS_EMPTY_NONE; } } else { @@ -74,10 +74,10 @@ // and a 'select a value' option for required fields that do not come // with a value selected. if (!$this->required) { - return self::OPTIONS_EMPTY_NONE; + return static::OPTIONS_EMPTY_NONE; } if (!$this->has_value) { - return self::OPTIONS_EMPTY_SELECT; + return static::OPTIONS_EMPTY_SELECT; } } } diff -u b/core/modules/options/options.module b/core/modules/options/options.module --- b/core/modules/options/options.module +++ b/core/modules/options/options.module @@ -8,6 +8,7 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\Entity\EntityInterface; use Drupal\field\FieldUpdateForbiddenException; +use Drupal\options\Plugin\field\widget\OptionsWidgetBase; /** * Implements hook_help(). @@ -451,8 +452,10 @@ * * @param $variables * An associative array containing: - * - option: A string representing the option that should be displayed. - * Either 'option_none' or 'option_select'. + * - option: A string representing the option that should be displayed. Either + * \Drupal\options\Plugin\field\widget\OptionsWidgetBase::OPTIONS_EMPTY_NONE + * or + * \Drupal\options\Plugin\field\widget\OptionsWidgetBase::OPTIONS_EMPTY_SELECT. * - widget: The widget object requesting the option. * - instance: The instance definition. * @@ -469,7 +472,7 @@ break; case 'options_select': - $output = ($option == 'option_none' ? t('- None -') : t('- Select a value -')); + $output = ($option == OptionsWidgetBase::OPTIONS_EMPTY_NONE ? t('- None -') : t('- Select a value -')); break; }