I have replaced deprecated code from .module and map.inc. It will not make it workable again but it will remove the old code.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

Title: Replace the deprecated code » Replace deprecated functions & system variables
Status: Needs review » Needs work

Looks like a good start.

  1. +++ b/admin_menu.module
    @@ -425,7 +433,7 @@ function admin_menu_js_cache() {
    +  return new Symfony\Component\HttpFoundation\Response($content);*/
    

    This looks a bit funny.

  2. +++ b/admin_menu.module
    @@ -452,7 +460,7 @@ function admin_menu_admin_menu_replacements($complete) {
    -  $interval   = REQUEST_TIME - variable_get('user_block_seconds_online', 900);
    +  $interval   = REQUEST_TIME - 900;
       $count_anon = admin_menu_session_count($interval, TRUE);
    

    AFAICT there is still a setting for this, just it's moved: see core/modules/migrate_drupal/src/Plugin/migrate/source/d6/Block.php

  3. +++ b/admin_menu.module
    @@ -511,16 +519,16 @@ function admin_menu_output($complete = FALSE) {
    +  $classes = '';
    
    @@ -532,12 +540,7 @@ function admin_menu_output($complete = FALSE) {
    +    $classes = 'admin-menu-site' . Unicode::strtolower(preg_replace('/[^a-zA-Z0-9-]/', '-', $GLOBALS['cookie_domain']));
    

    You're redefining $classes.

  4. +++ b/admin_menu.module
    @@ -582,14 +585,13 @@ function admin_menu_output($complete = FALSE) {
    -      cache('menu')->set($cid, $content, CacheBackendInterface::CACHE_PERMANENT, $tags);
    -    }
    +      \Drupal::cache('menu')->set($cid, $content, CacheBackendInterface::CACHE_PERMANENT, $tags);
    

    This looks wrong: we're losing a }.

  5. +++ b/admin_menu.module
    @@ -773,9 +775,11 @@ function admin_menu_element_sort($a, $b) {
    + * @todo what to do with this
    + *
    

    Maybe file a new issue to consider this, rather than put a todo in the code? I see you've commented it out -- does it do any harm if left live?

joachim’s picture

Assigned: Unassigned » joachim

This is going to need a reroll in light of #2401457: replace system variables with configuration API. I'll take care of it :)

joachim’s picture

Status: Needs work » Needs review
Parent issue: » #2398395: [meta] Port Admin Menu to Drupal 8
FileSize
17.23 KB

Updated patch.

Applied on top of the other patches from the parent issue, this gets us as far as entity problems in hook_admin_menu_map() implementations.

forestmars’s picture

Hmm, patch is not applying for me against latest 8.x-3.x-dev:

$patch -p1 < 2393983.3.admin_menu.replace-deprecated-system-apis.patch
patching file admin_menu.inc
patching file admin_menu.map.inc
patching file admin_menu.module
Hunk #2 succeeded at 206 (offset 33 lines).
Hunk #3 succeeded at 243 (offset 33 lines).
Hunk #4 succeeded at 272 (offset 33 lines).
Hunk #5 FAILED at 305.
Hunk #6 succeeded at 335 (offset 33 lines).
Hunk #7 succeeded at 373 (offset 33 lines).
Hunk #8 FAILED at 397.
Hunk #9 succeeded at 407 (offset 33 lines).
Hunk #10 succeeded at 447 (offset 33 lines).
Hunk #11 succeeded at 474 (offset 33 lines).
Hunk #12 FAILED at 517.
Hunk #13 succeeded at 533 (offset 33 lines).
Hunk #14 succeeded at 554 (offset 38 lines).
Hunk #15 succeeded at 591 (offset 38 lines).
Hunk #16 succeeded at 599 (offset 38 lines).
Hunk #17 succeeded at 626 (offset 38 lines).
Hunk #18 succeeded at 705 (offset 38 lines).
Hunk #19 succeeded at 716 (offset 38 lines).
Hunk #20 succeeded at 746 (offset 38 lines).
Hunk #21 succeeded at 788 (offset 38 lines).
Hunk #22 succeeded at 859 (offset 38 lines).
Hunk #23 succeeded at 913 (offset 38 lines).
3 out of 23 hunks FAILED -- saving rejects to file admin_menu.module.rej
joachim’s picture

> Applied on top of the other patches from the parent issue, this gets us as far as entity problems in hook_admin_menu_map() implementations.

This needs to go on top of prior issues -- see the parent issue for the list.

kerby70’s picture

Attaching reroll including continued replacements of calls.

Apply after #2401457: replace system variables with configuration API #5.

HongPong’s picture

Sorry - posted the wrong patch file here. Plz disregard

HongPong’s picture

Status: Needs review » Needs work

A lot of these are good but need a re-roll. Some parts have already been committed I think.

thalles’s picture

Category: Task » Support request

This module has been deprecated for Drupal 8.
For Drupal 8: the Admin Toolbar provides an experience similar to admin_menu with the core toolbar.

thalles’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.