function ViewsConfigUpdater::processMinMaxLabelUpdate

Adds default min_label and max_label to exposed numeric-type filters.

Only filters that already have min_placeholder (indicating they derive from NumericFilter) but lack min_label are updated. The legacy hardcoded labels "Min" and "Max" are used so existing sites are visually unchanged.

Parameters

array $handler: A display handler.

string $handler_type: The handler type.

Return value

bool Whether the handler was updated.

File

core/modules/views/src/ViewsConfigUpdater.php, line 505

Class

ViewsConfigUpdater
Provides a BC layer for modules providing old configurations.

Namespace

Drupal\views

Code

public function processMinMaxLabelUpdate(array &$handler, string $handler_type) : bool {
  if ($handler_type === 'filter' && array_key_exists('min_placeholder', $handler['expose'] ?? []) && !array_key_exists('min_label', $handler['expose'] ?? [])) {
    $handler['expose']['min_label'] = 'Min';
    $handler['expose']['max_label'] = 'Max';
    return TRUE;
  }
  return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.