Fixed
Project:
Content First
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
12 May 2026 at 16:45 UTC
Updated:
12 May 2026 at 17:00 UTC
Jump to comment: Most recent
Running drush content-first:export --entity=menu --language=en exports menus in all site languages instead of only the requested one.
There are two bugs in ContentFirstCommands::export():
$languages variable is parsed after exportMenus() is called, so it is never available for menu exports.exportMenus() does not accept a language filter parameter at all — it always iterates over every language returned by LanguageManagerInterface::getLanguages().The @option language docblock also incorrectly documents the option as "nodes only", which is misleading.
drush content-first:export --entity=menu --language=en.menu-en-main.md and menu-es-main.md) are exported instead of only menu-en-main.md.$languages parsing block above the exportMenus() call in export().$languages as a new parameter to exportMenus().exportMenus(), skip any language not present in the requested list when the list is non-empty.@option language docblock to remove the "(nodes only)" restriction.Relevant changes to src/Commands/ContentFirstCommands.php:
// Move language parsing before exportMenus() call. $languages = !empty($options['language']) ? array_map('trim', explode(',', $options['language'])) : []; if ($exportMenus) { $this->exportMenus($folder, $bundles, $status, $rewriteLinks, $languages); } protected function exportMenus( string $folder, array $bundles, ?int $status = NULL, bool $rewriteLinks = FALSE, array $languages = [], ): void { // ... $allLanguages = $this->languageManager->getLanguages(); foreach ($allLanguages as $langcode => $language) { if (!empty($languages) && !in_array($langcode, $languages, TRUE)) { continue; } // export logic } } ContentFirstCommands covering the language filter for menus.ContentFirstCommands::exportMenus() gains a new optional parameter array $languages = []. Existing callers passing positional arguments are unaffected since it is appended with a default value.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
gedur commented