diff options
Diffstat (limited to 'core/includes')
-rw-r--r-- | core/includes/install.core.inc | 2 | ||||
-rw-r--r-- | core/includes/theme.inc | 558 |
2 files changed, 86 insertions, 474 deletions
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index cde18fc831e5..35fa223c31de 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -389,7 +389,7 @@ function install_begin_request($class_loader, &$install_state): void { } $install_state['database_verified'] = install_verify_database_settings($site_path); // A valid settings.php has database settings and a hash_salt value. Other - // settings will be checked by system_requirements(). + // settings will be checked by \Drupal\system\Install\SystemRequirements. $install_state['settings_verified'] = $install_state['config_verified'] && $install_state['database_verified'] && (bool) Settings::get('hash_salt', FALSE); if ($install_state['settings_verified']) { diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 5a53d94962b5..587f9e70c200 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -10,18 +10,16 @@ use Drupal\Core\Datetime\DatePreprocess; use Drupal\Core\Field\FieldPreprocess; +use Drupal\Core\Pager\PagerPreprocess; +use Drupal\Core\Breadcrumb\BreadcrumbPreprocess; +use Drupal\Core\Menu\MenuPreprocess; +use Drupal\Core\Theme\ImagePreprocess; use Drupal\Core\Theme\ThemePreprocess; -use Drupal\Core\Url; -use Drupal\Component\Utility\Html; use Drupal\Core\Config\Config; use Drupal\Core\Config\StorageException; -use Drupal\Core\Template\Attribute; use Drupal\Core\Template\AttributeHelper; use Drupal\Core\Theme\ThemeCommonElements; use Drupal\Core\Theme\ThemeSettings; -use Drupal\Core\Render\Element; -use Drupal\Core\Utility\TableSort; -use Drupal\Core\Installer\InstallerKernel; /** * @defgroup content_flags Content markers @@ -484,49 +482,15 @@ function template_preprocess_links(&$variables): void { * - sizes: The sizes attribute for viewport-based selection of images. * phpcs:ignore * - http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content.html#introduction-3:viewport-based-selection-2 + * + * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial + * template_preprocess functions are registered directly in hook_theme(). + * + * @see https://www.drupal.org/node/3504125 */ function template_preprocess_image(&$variables): void { - /** @var \Drupal\Core\File\FileUrlGeneratorInterface $file_url_generator */ - $file_url_generator = \Drupal::service('file_url_generator'); - - if (!empty($variables['uri'])) { - $variables['attributes']['src'] = $file_url_generator->generateString($variables['uri']); - } - // Generate a srcset attribute conforming to the spec at - // https://www.w3.org/html/wg/drafts/html/master/embedded-content.html#attr-img-srcset - if (!empty($variables['srcset'])) { - $srcset = []; - foreach ($variables['srcset'] as $src) { - // URI is mandatory. - $source = $file_url_generator->generateString($src['uri']); - if (isset($src['width']) && !empty($src['width'])) { - $source .= ' ' . $src['width']; - } - elseif (isset($src['multiplier']) && !empty($src['multiplier'])) { - $source .= ' ' . $src['multiplier']; - } - $srcset[] = $source; - } - $variables['attributes']['srcset'] = implode(', ', $srcset); - } - - foreach (['width', 'height', 'alt', 'title', 'sizes'] as $key) { - if (isset($variables[$key])) { - // If the property has already been defined in the attributes, - // do not override, including NULL. - if (AttributeHelper::attributeExists($key, $variables['attributes'])) { - continue; - } - $variables['attributes'][$key] = $variables[$key]; - } - } - - // Without dimensions specified, layout shifts can occur, - // which are more noticeable on pages that take some time to load. - // As a result, only mark images as lazy load that have dimensions. - if (isset($variables['width'], $variables['height']) && !isset($variables['attributes']['loading'])) { - $variables['attributes']['loading'] = 'lazy'; - } + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED); + \Drupal::service(ImagePreprocess::class)->preprocessImage($variables); } /** @@ -620,167 +584,15 @@ function template_preprocess_image(&$variables): void { * - sticky: Use a "sticky" table header. * - empty: The message to display in an extra row if table does not have any * rows. + * + * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial + * template_preprocess functions are registered directly in hook_theme(). + * + * @see https://www.drupal.org/node/3504125 */ function template_preprocess_table(&$variables): void { - // Format the table columns: - if (!empty($variables['colgroups'])) { - foreach ($variables['colgroups'] as &$colgroup) { - // Check if we're dealing with a simple or complex column - if (isset($colgroup['data'])) { - $cols = $colgroup['data']; - unset($colgroup['data']); - $colgroup_attributes = $colgroup; - } - else { - $cols = $colgroup; - $colgroup_attributes = []; - } - $colgroup = []; - $colgroup['attributes'] = new Attribute($colgroup_attributes); - $colgroup['cols'] = []; - - // Build columns. - if (is_array($cols) && !empty($cols)) { - foreach ($cols as $col_key => $col) { - $colgroup['cols'][$col_key]['attributes'] = new Attribute($col); - } - } - } - } - - // Build an associative array of responsive classes keyed by column. - $responsive_classes = []; - - // Format the table header: - $ts = []; - $header_columns = 0; - if (!empty($variables['header'])) { - $ts = TableSort::getContextFromRequest($variables['header'], \Drupal::request()); - - // Use a separate index with responsive classes as headers - // may be associative. - $responsive_index = -1; - foreach ($variables['header'] as $col_key => $cell) { - // Increase the responsive index. - $responsive_index++; - - if (!is_array($cell)) { - $header_columns++; - $cell_content = $cell; - $cell_attributes = new Attribute(); - $is_header = TRUE; - } - else { - if (isset($cell['colspan'])) { - $header_columns += $cell['colspan']; - } - else { - $header_columns++; - } - $cell_content = ''; - if (isset($cell['data'])) { - $cell_content = $cell['data']; - unset($cell['data']); - } - // Flag the cell as a header or not and remove the flag. - $is_header = $cell['header'] ?? TRUE; - unset($cell['header']); - - // Track responsive classes for each column as needed. Only the header - // cells for a column are marked up with the responsive classes by a - // module developer or themer. The responsive classes on the header - // cells must be transferred to the content cells. - if (!empty($cell['class']) && is_array($cell['class'])) { - if (in_array(RESPONSIVE_PRIORITY_MEDIUM, $cell['class'])) { - $responsive_classes[$responsive_index] = RESPONSIVE_PRIORITY_MEDIUM; - } - elseif (in_array(RESPONSIVE_PRIORITY_LOW, $cell['class'])) { - $responsive_classes[$responsive_index] = RESPONSIVE_PRIORITY_LOW; - } - } - - TableSort::header($cell_content, $cell, $variables['header'], $ts); - - // TableSort::header() removes the 'sort', 'initial_click_sort' and - // 'field' keys. - $cell_attributes = new Attribute($cell); - } - $variables['header'][$col_key] = []; - $variables['header'][$col_key]['tag'] = $is_header ? 'th' : 'td'; - $variables['header'][$col_key]['attributes'] = $cell_attributes; - $variables['header'][$col_key]['content'] = $cell_content; - } - } - $variables['header_columns'] = $header_columns; - - // Rows and footer have the same structure. - $sections = ['rows' , 'footer']; - foreach ($sections as $section) { - if (!empty($variables[$section])) { - foreach ($variables[$section] as $row_key => $row) { - $cells = $row; - $row_attributes = []; - - // Check if we're dealing with a simple or complex row - if (isset($row['data'])) { - $cells = $row['data']; - $variables['no_striping'] = $row['no_striping'] ?? FALSE; - - // Set the attributes array and exclude 'data' and 'no_striping'. - $row_attributes = $row; - unset($row_attributes['data']); - unset($row_attributes['no_striping']); - } - - // Build row. - $variables[$section][$row_key] = []; - $variables[$section][$row_key]['attributes'] = new Attribute($row_attributes); - $variables[$section][$row_key]['cells'] = []; - if (!empty($cells)) { - // Reset the responsive index. - $responsive_index = -1; - foreach ($cells as $col_key => $cell) { - // Increase the responsive index. - $responsive_index++; - - if (!is_array($cell)) { - $cell_content = $cell; - $cell_attributes = []; - $is_header = FALSE; - } - else { - $cell_content = ''; - if (isset($cell['data'])) { - $cell_content = $cell['data']; - unset($cell['data']); - } - - // Flag the cell as a header or not and remove the flag. - $is_header = !empty($cell['header']); - unset($cell['header']); - - $cell_attributes = $cell; - } - // Active table sort information. - if (isset($variables['header'][$col_key]['data']) && $variables['header'][$col_key]['data'] == $ts['name'] && !empty($variables['header'][$col_key]['field'])) { - $variables[$section][$row_key]['cells'][$col_key]['active_table_sort'] = TRUE; - } - // Copy RESPONSIVE_PRIORITY_LOW/RESPONSIVE_PRIORITY_MEDIUM - // class from header to cell as needed. - if (isset($responsive_classes[$responsive_index])) { - $cell_attributes['class'][] = $responsive_classes[$responsive_index]; - } - $variables[$section][$row_key]['cells'][$col_key]['tag'] = $is_header ? 'th' : 'td'; - $variables[$section][$row_key]['cells'][$col_key]['attributes'] = new Attribute($cell_attributes); - $variables[$section][$row_key]['cells'][$col_key]['content'] = $cell_content; - } - } - } - } - } - if (empty($variables['no_striping'])) { - $variables['attributes']['data-striping'] = 1; - } + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED); + \Drupal::service(ThemePreprocess::class)->preprocessTable($variables); } /** @@ -800,56 +612,14 @@ function template_preprocess_table(&$variables): void { * - list_type: The type of list to return (e.g. "ul", "ol"). * - wrapper_attributes: HTML attributes to be applied to the list wrapper. * - * @see https://www.drupal.org/node/1842756 + * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial + * template_preprocess functions are registered directly in hook_theme(). + * + * @see https://www.drupal.org/node/3504125 */ function template_preprocess_item_list(&$variables): void { - $variables['wrapper_attributes'] = new Attribute($variables['wrapper_attributes']); - $variables['#attached']['library'][] = 'core/drupal.item-list'; - foreach ($variables['items'] as &$item) { - $attributes = []; - // If the item value is an array, then it is a render array. - if (is_array($item)) { - // List items support attributes via the '#wrapper_attributes' property. - if (isset($item['#wrapper_attributes'])) { - $attributes = $item['#wrapper_attributes']; - } - // Determine whether there are any child elements in the item that are not - // fully-specified render arrays. If there are any, then the child - // elements present nested lists and we automatically inherit the render - // array properties of the current list to them. - foreach (Element::children($item) as $key) { - $child = &$item[$key]; - // If this child element does not specify how it can be rendered, then - // we need to inherit the render properties of the current list. - if (!isset($child['#type']) && !isset($child['#theme']) && !isset($child['#markup'])) { - // Since item-list.html.twig supports both strings and render arrays - // as items, the items of the nested list may have been specified as - // the child elements of the nested list, instead of #items. For - // convenience, we automatically move them into #items. - if (!isset($child['#items'])) { - // This is the same condition as in - // \Drupal\Core\Render\Element::children(), which cannot be used - // here, since it triggers an error on string values. - foreach ($child as $child_key => $child_value) { - if (is_int($child_key) || $child_key === '' || $child_key[0] !== '#') { - $child['#items'][$child_key] = $child_value; - unset($child[$child_key]); - } - } - } - // Lastly, inherit the original theme variables of the current list. - $child['#theme'] = $variables['theme_hook_original']; - $child['#list_type'] = $variables['list_type']; - } - } - } - - // Set the item's value and attributes for the template. - $item = [ - 'value' => $item, - 'attributes' => new Attribute($attributes), - ]; - } + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED); + \Drupal::service(ThemePreprocess::class)->preprocessItemList($variables); } /** @@ -883,27 +653,15 @@ function template_preprocess_container(&$variables): void { * It's the caller's responsibility to ensure this array's items contain no * dangerous HTML such as <script> tags. * - active: The key for the currently active maintenance task. + * + * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial + * template_preprocess functions are registered directly in hook_theme(). + * + * @see https://www.drupal.org/node/3504125 */ function template_preprocess_maintenance_task_list(&$variables): void { - $items = $variables['items']; - $active = $variables['active']; - - $done = isset($items[$active]) || $active == NULL; - foreach ($items as $k => $item) { - $variables['tasks'][$k]['item'] = $item; - $variables['tasks'][$k]['attributes'] = new Attribute(); - if ($active == $k) { - $variables['tasks'][$k]['attributes']->addClass('is-active'); - $variables['tasks'][$k]['status'] = t('active'); - $done = FALSE; - } - else { - if ($done) { - $variables['tasks'][$k]['attributes']->addClass('done'); - $variables['tasks'][$k]['status'] = t('done'); - } - } - } + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED); + \Drupal::service(ThemePreprocess::class)->preprocessMaintenanceTaskList($variables); } /** @@ -1053,9 +811,15 @@ function theme_get_suggestions($args, $base, $delimiter = '__'): array { * Prepares variables for tablesort indicators. * * Default template: tablesort-indicator.html.twig. + * + * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial + * template_preprocess functions are registered directly in hook_theme(). + * + * @see https://www.drupal.org/node/3504125 */ function template_preprocess_tablesort_indicator(&$variables): void { - $variables['#attached']['library'][] = 'core/drupal.tablesort'; + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED); + \Drupal::service(ThemePreprocess::class)->preprocessTablesortIndicator($variables); } /** @@ -1067,25 +831,14 @@ function template_preprocess_tablesort_indicator(&$variables): void { * An associative array containing: * - content - An array of page content. * - * @see system_page_attachments() + * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial + * template_preprocess functions are registered directly in hook_theme(). + * + * @see https://www.drupal.org/node/3504125 */ function template_preprocess_maintenance_page(&$variables): void { - // @todo Rename the templates to page--maintenance + page--install. - \Drupal::service(ThemePreprocess::class)->preprocessPage($variables); - - // @see system_page_attachments() - $variables['#attached']['library'][] = 'system/maintenance'; - - // Maintenance page and install page need branding info in variables because - // there is no blocks. - $site_config = \Drupal::config('system.site'); - $variables['logo'] = theme_get_setting('logo.url'); - $variables['site_name'] = $site_config->get('name'); - $variables['site_slogan'] = $site_config->get('slogan'); - - // Maintenance page and install page need page title in variable because there - // are no blocks. - $variables['title'] = $variables['page']['#title']; + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED); + \Drupal::service(ThemePreprocess::class)->preprocessMaintenancePage($variables); } /** @@ -1097,21 +850,14 @@ function template_preprocess_maintenance_page(&$variables): void { * An associative array containing: * - content - An array of page content. * - * @see template_preprocess_maintenance_page() + * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial + * template_preprocess functions are registered directly in hook_theme(). + * + * @see https://www.drupal.org/node/3504125 */ function template_preprocess_install_page(&$variables): void { - $installer_active_task = NULL; - if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE === 'install' && InstallerKernel::installationAttempted()) { - $installer_active_task = $GLOBALS['install_state']['active_task']; - } - - template_preprocess_maintenance_page($variables); - - // Override the site name that is displayed on the page, since Drupal is - // still in the process of being installed. - $distribution_name = drupal_install_profile_distribution_name(); - $variables['site_name'] = $distribution_name; - $variables['site_version'] = $installer_active_task ? drupal_install_profile_distribution_version() : ''; + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED); + \Drupal::service(ThemePreprocess::class)->preprocessInstallPage($variables); } /** @@ -1126,11 +872,15 @@ function template_preprocess_install_page(&$variables): void { * @param array $variables * An associative array containing: * - elements: An associative array containing properties of the region. + * + * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial + * template_preprocess functions are registered directly in hook_theme(). + * + * @see https://www.drupal.org/node/3504125 */ function template_preprocess_region(&$variables): void { - // Create the $content variable that templates expect. - $variables['content'] = $variables['elements']['#children']; - $variables['region'] = $variables['elements']['#region']; + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED); + \Drupal::service(ThemePreprocess::class)->preprocessRegion($variables); } /** @@ -1183,13 +933,15 @@ function template_preprocess_field_multiple_value_form(&$variables): void { * @param array $variables * An associative array containing: * - links: A list of \Drupal\Core\Link objects which should be rendered. + * + * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial + * template_preprocess functions are registered directly in hook_theme(). + * + * @see https://www.drupal.org/node/3504125 */ function template_preprocess_breadcrumb(&$variables): void { - $variables['breadcrumb'] = []; - /** @var \Drupal\Core\Link $link */ - foreach ($variables['links'] as $key => $link) { - $variables['breadcrumb'][$key] = ['text' => $link->getText(), 'url' => $link->getUrl()->toString()]; - } + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED); + \Drupal::service(BreadcrumbPreprocess::class)->preprocessBreadcrumb($variables); } /** @@ -1212,137 +964,15 @@ function template_preprocess_breadcrumb(&$variables): void { * to the pager links. * - #route_parameters: An associative array of the route parameters. * - #quantity: The number of pages in the list. + * + * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial + * template_preprocess functions are registered directly in hook_theme(). + * + * @see https://www.drupal.org/node/3504125 */ function template_preprocess_pager(&$variables): void { - $element = $variables['pager']['#element']; - $parameters = $variables['pager']['#parameters']; - $quantity = empty($variables['pager']['#quantity']) ? 0 : $variables['pager']['#quantity']; - $route_name = $variables['pager']['#route_name']; - $route_parameters = $variables['pager']['#route_parameters'] ?? []; - - /** @var \Drupal\Core\Pager\PagerManagerInterface $pager_manager */ - $pager_manager = \Drupal::service('pager.manager'); - - $pager = $pager_manager->getPager($element); - - // Nothing to do if there is no pager. - if (!isset($pager)) { - return; - } - - $pager_max = $pager->getTotalPages(); - - // Nothing to do if there is only one page. - if ($pager_max <= 1) { - return; - } - - $tags = $variables['pager']['#tags']; - - // Calculate various markers within this pager piece: - // Middle is used to "center" pages around the current page. - $pager_middle = ceil($quantity / 2); - $current_page = $pager->getCurrentPage(); - // The current pager is the page we are currently paged to. - $pager_current = $current_page + 1; - // The first pager is the first page listed by this pager piece (re quantity). - $pager_first = $pager_current - $pager_middle + 1; - // The last is the last page listed by this pager piece (re quantity). - $pager_last = $pager_current + $quantity - $pager_middle; - // End of marker calculations. - - // Prepare for generation loop. - $i = $pager_first; - if ($pager_last > $pager_max) { - // Adjust "center" if at end of query. - $i = $i + ($pager_max - $pager_last); - $pager_last = $pager_max; - } - if ($i <= 0) { - // Adjust "center" if at start of query. - $pager_last = $pager_last + (1 - $i); - $i = 1; - } - // End of generation loop preparation. - - // Create the "first" and "previous" links if we are not on the first page. - if ($current_page > 0) { - $items['first'] = []; - $items['first']['attributes'] = new Attribute(); - $options = [ - 'query' => $pager_manager->getUpdatedParameters($parameters, $element, 0), - ]; - $items['first']['href'] = Url::fromRoute($route_name, $route_parameters, $options)->toString(); - if (isset($tags[0])) { - $items['first']['text'] = $tags[0]; - } - - $items['previous'] = []; - $items['previous']['attributes'] = new Attribute(); - $options = [ - 'query' => $pager_manager->getUpdatedParameters($parameters, $element, $current_page - 1), - ]; - $items['previous']['href'] = Url::fromRoute($route_name, $route_parameters, $options)->toString(); - if (isset($tags[1])) { - $items['previous']['text'] = $tags[1]; - } - } - - // Add an ellipsis if there are further previous pages. - if ($i > 1) { - $variables['ellipses']['previous'] = TRUE; - } - // Now generate the actual pager piece. - for (; $i <= $pager_last && $i <= $pager_max; $i++) { - $options = [ - 'query' => $pager_manager->getUpdatedParameters($parameters, $element, $i - 1), - ]; - $items['pages'][$i]['href'] = Url::fromRoute($route_name, $route_parameters, $options)->toString(); - $items['pages'][$i]['attributes'] = new Attribute(); - if ($i == $pager_current) { - $variables['current'] = $i; - $items['pages'][$i]['attributes']->setAttribute('aria-current', 'page'); - } - } - // Add an ellipsis if there are further next pages. - if ($i < $pager_max + 1) { - $variables['ellipses']['next'] = TRUE; - } - - // Create the "next" and "last" links if we are not on the last page. - if ($current_page < ($pager_max - 1)) { - $items['next'] = []; - $items['next']['attributes'] = new Attribute(); - $options = [ - 'query' => $pager_manager->getUpdatedParameters($parameters, $element, $current_page + 1), - ]; - $items['next']['href'] = Url::fromRoute($route_name, $route_parameters, $options)->toString(); - if (isset($tags[3])) { - $items['next']['text'] = $tags[3]; - } - - $items['last'] = []; - $items['last']['attributes'] = new Attribute(); - $options = [ - 'query' => $pager_manager->getUpdatedParameters($parameters, $element, $pager_max - 1), - ]; - $items['last']['href'] = Url::fromRoute($route_name, $route_parameters, $options)->toString(); - if (isset($tags[4])) { - $items['last']['text'] = $tags[4]; - } - } - - $variables['items'] = $items; - $variables['heading_id'] = Html::getUniqueId('pagination-heading'); - $variables['pagination_heading_level'] = $variables['pager']['#pagination_heading_level'] ?? 'h4'; - if (!preg_match('/^h[1-6]$/', $variables['pagination_heading_level'])) { - $variables['pagination_heading_level'] = 'h4'; - } - - // The rendered link needs to play well with any other query parameter used - // on the page, like exposed filters, so for the cacheability all query - // parameters matter. - $variables['#cache']['contexts'][] = 'url.query_args'; + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED); + \Drupal::service(PagerPreprocess::class)->preprocessPager($variables); } /** @@ -1356,26 +986,15 @@ function template_preprocess_pager(&$variables): void { * - #link: A menu link array with 'title', 'url', and (optionally) * 'localized_options' keys. * - #active: A boolean indicating whether the local task is active. + * + * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial + * template_preprocess functions are registered directly in hook_theme(). + * + * @see https://www.drupal.org/node/3504125 */ function template_preprocess_menu_local_task(&$variables): void { - $link = $variables['element']['#link']; - $link += [ - 'localized_options' => [], - ]; - $link_text = $link['title']; - - if (!empty($variables['element']['#active'])) { - $variables['is_active'] = TRUE; - } - - $link['localized_options']['set_active_class'] = TRUE; - - $variables['link'] = [ - '#type' => 'link', - '#title' => $link_text, - '#url' => $link['url'], - '#options' => $link['localized_options'], - ]; + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED); + \Drupal::service(MenuPreprocess::class)->preprocessMenuLocalTask($variables); } /** @@ -1388,22 +1007,15 @@ function template_preprocess_menu_local_task(&$variables): void { * - element: A render element containing: * - #link: A menu link array with 'title', 'url', and (optionally) * 'localized_options' keys. + * + * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial + * template_preprocess functions are registered directly in hook_theme(). + * + * @see https://www.drupal.org/node/3504125 */ function template_preprocess_menu_local_action(&$variables): void { - $link = $variables['element']['#link']; - $link += [ - 'localized_options' => [], - ]; - $link['localized_options']['attributes']['class'][] = 'button'; - $link['localized_options']['attributes']['class'][] = 'button-action'; - $link['localized_options']['set_active_class'] = TRUE; - - $variables['link'] = [ - '#type' => 'link', - '#title' => $link['title'], - '#options' => $link['localized_options'], - '#url' => $link['url'], - ]; + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED); + \Drupal::service(MenuPreprocess::class)->preprocessMenuLocalAction($variables); } /** |