Bring back the possibility of exporting and importing menus directly using drush

Created on 9 November 2024, 6 days ago

System information

  • Drupal Core Version: 10.2 and above
  • Menu Migration Version: 4.0.0
  • PHP Version: >=8.1, <=8.3

Problem/Motivation

As per suggestions in this ticket 🌱 In-depth Module Documentation Active , and not only, in some cases it would be nice to be able to export and import menus quickly using Drush without having to create a Configuration Entity.

This was possible in versions 3 and below.

Steps to reproduce

Compare the behaviour in version 3 with version 4 of the Drush commands.

Proposed resolution

Since drush mme and drush mmi are already tight to Configuration Entities (Export Type and Import Type at the time of writing), the proposed solution is to create new commands drush mmqe and drush mmqi (short for quick export and quick import) that would allow the users to export menus directly by passing the menu IDs as argument to the commands, the same way it was working in version 3.

The automatic multisite folder structure will not be included, but I'm considering creating a separate issue where we add a checkbox to the Codebase plugin to automatically create subfolders per site if needed, which would apply globally including for Export Types.

Feature request
Status

Active

Version

4.0

Component

Code

Created by

🇷🇴Romania bbu23

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @bbu23
  • 🇷🇴Romania bbu23

    I pushed the initial changes, drush updb needs to be run.
    I'm setting the issue status to Needs work while I work on updating the README file and test on multiple versions.

  • 🇩🇰Denmark ressa Copenhagen

    Outstanding work! I tried it and it worked really well: I added the patch, ran drush updatedb, exported and imported a menu. Everything went smoothly, so as far as I can tell, it works perfectly.

    There were a few details in the documentation, about using full commands vs. aliases. But that's a very minor issue. I added comments and suggestions, and if you agree with them, you should be able to simply commit my suggestions via the Gitlab GUI.

    Thanks again, this is great!

  • 🇷🇴Romania bbu23

    Thank you for your feedback, I was expecting feedback especially in this direction, so that's perfectly fine.
    I do prefer aliases due to faster typing, so I might just mention both to cover both. I'll be back.

    • bbu23 committed 36582e8a on 4.0.x
      Issue #3486499: Bring back the possibility of exporting and importing...
  • 🇷🇴Romania bbu23

    @ressa thank you as always!
    Marking as Fixed.

  • 🇩🇰Denmark ressa Copenhagen

    Thanks @bbu23, this is perfection!

  • 🇩🇰Denmark ressa Copenhagen

    Actually, I have been thinking more about this, and I think the GUI part should maybe be removed, for a more "pure" Drush integration ... I created a follow up issue.

  • 🇷🇴Romania bbu23

    Thanks @ressa. You know, I was a bit surprised that in your yesterday's feedback there was nothing about this. Because I had troubles naming it hahah

    My dilema was that I didn't want to have something that says "this is the only Drush option". Because, as we both know, Drush is available in both scenarios. The only difference is that this "quick export" is offering codebase only Drush commands that can be used immediately with minimal configuration if the user wants to change it, whereas for more stable/regular imports/exports, the user would have to go through multiple steps to be able to use Drush if they want.

    So, my question is: if we call it "Drush Export/Import", isn't it implying that this section is the only Drush section available? That's where I added "quick". Now, I was not necessarily pleased by the "Action" name, I added this because I was thinking that it reduces "Import/Export" into one word, but it is not ideal. Also, I was thinking of potentially creating a form of "quick action" (let's say) or two forms "quick import" and "quick export" to import/export on the fly menus using GUI and using the contents of the Configuration Entities for one time situations. Like maybe when I want to quickly download a menu from production, instead of creating a config entity before, to have this possibility. And that's how I arrived to that.

  • 🇷🇴Romania bbu23

    The --format option will be added to the new commands based on the discussion in the related ticket.

  • 🇩🇰Denmark ressa Copenhagen

    The eternal challenge of naming things is rearing its ugly head again!

    I get your dilemma, since the other option of import/export also has Drush integration, in its own way ...

    Thanks for elaborating with your thoughts behind the naming. After all is considered, maybe it should stay named as it is, but the description below could feature the word "Drush" prominently and explain how it is different? Maybe something along these lines?

    Quick Action Settings
    Drush-driven exports and imports, for a faster process.

  • 🇷🇴Romania bbu23

    I like it!

    Yes, naming naming... :D

    Perfect, in this case I'll use that description, it's perfect. And update the format. Thanks!

  • 🇩🇰Denmark ressa Copenhagen

    You're welcome, thanks!

    • bbu23 committed 3fe84e5c on 4.0.x
      Issue #3486499: Add format option to quick import/export Drush commands...
  • 🇷🇴Romania bbu23

    The format option has been added and the menu description updated.
    This should resolve the remaining feedback.
    Thank you!

  • 🇷🇴Romania bbu23

    Actually, I forgot to update the README. Reopening.

    • bbu23 committed b35fdc7c on 4.0.x
      Issue #3486499: Update README to include new Drush format option.
      
Production build 0.71.5 2024