diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php index 30f7167..7401512 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php @@ -20,23 +20,6 @@ */ /** - * Indicator of the renderText() method for rendering a single item. - * (If no render_item() is present). - */ -define('VIEWS_HANDLER_RENDER_TEXT_PHASE_SINGLE_ITEM', 0); - -/** - * Indicator of the renderText() method for rendering the whole element. - * (if no render_item() method is available). - */ -define('VIEWS_HANDLER_RENDER_TEXT_PHASE_COMPLETELY', 1); - -/** - * Indicator of the renderText() method for rendering the empty text. - */ -define('VIEWS_HANDLER_RENDER_TEXT_PHASE_EMPTY', 2); - -/** * Base field handler that has no options and renders an unformatted field. * * Definition terms: @@ -51,6 +34,23 @@ */ abstract class FieldPluginBase extends HandlerBase { + /** + * Indicator for the renderText() method rendering a single item. + * (If no render_item() method is present). + */ + const RENDER_TEXT_PHASE_SINGLE_ITEM = 0; + + /** + * Indicator for the renderText() method rendering the whole element. + * (if no render_item() method is available). + */ + const RENDER_TEXT_PHASE_COMPLETELY = 1; + + /** + * Indicator for the renderText() method rendering empty text. + */ + const RENDER_TEXT_PHASE_EMPTY = 2; + var $field_alias = 'unknown'; var $aliases = array(); @@ -279,7 +279,7 @@ public function getElements() { '' => t(' - Use default -'), '0' => t('- None -') ); - $elements += config('views.settings')->get('field_rewrite_elements'); + $elements += \Drupal::config('views.settings')->get('field_rewrite_elements'); } return $elements; @@ -1139,14 +1139,14 @@ public function advancedRender($values) { $this->original_value = $this->last_render; $alter = $item + $this->options['alter']; - $alter['phase'] = VIEWS_HANDLER_RENDER_TEXT_PHASE_SINGLE_ITEM; + $alter['phase'] = static::RENDER_TEXT_PHASE_SINGLE_ITEM; $items[] = $this->renderText($alter); } $value = $this->renderItems($items); } else { - $alter = array('phase' => VIEWS_HANDLER_RENDER_TEXT_PHASE_COMPLETELY) + $this->options['alter']; + $alter = array('phase' => static::RENDER_TEXT_PHASE_COMPLETELY) + $this->options['alter']; $value = $this->renderText($alter); } @@ -1163,7 +1163,7 @@ public function advancedRender($values) { $alter = $this->options['alter']; $alter['alter_text'] = 1; $alter['text'] = $this->options['empty']; - $alter['phase'] = VIEWS_HANDLER_RENDER_TEXT_PHASE_EMPTY; + $alter['phase'] = static::RENDER_TEXT_PHASE_EMPTY; $this->last_render = $this->renderText($alter); } } @@ -1223,12 +1223,12 @@ public function renderText($alter) { // First check whether the field should be hidden if the value(hide_alter_empty = TRUE) /the rewrite is empty (hide_alter_empty = FALSE). // For numeric values you can specify whether "0"/0 should be empty. if ((($this->options['hide_empty'] && empty($value)) - || ($alter['phase'] != VIEWS_HANDLER_RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty)) + || ($alter['phase'] != static::RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty)) && $this->isValueEmpty($value, $this->options['empty_zero'], FALSE)) { return ''; } // Only in empty phase. - if ($alter['phase'] == VIEWS_HANDLER_RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty) { + if ($alter['phase'] == static::RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty) { // If we got here then $alter contains the value of "No results text" // and so there is nothing left to do. return $value;