Don't use the word Type in the UI

Created on 8 November 2024, about 1 month ago

Problem/Motivation

As an ordinary user of the module, the word "Type" doesn't convey meaning to me, such as these instances in the GUI:

  • Export Types
  • Import Types
  • Add Export Type
  • Create new import type

Steps to reproduce

Using the module and wonder what a "Type" is ...

Proposed resolution

Use "Menu" instead of "Type".

Before and after:

Menu Migration
Now:

Proposal:

Export list
Now:

Proposal:

Add Export
Now:

Proposal:

📌 Task
Status

Active

Version

4.0

Component

User interface

Created by

🇩🇰Denmark ressa Copenhagen

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

Merge Requests

Comments & Activities

  • Issue created by @ressa
  • 🇩🇰Denmark ressa Copenhagen

    I can create an MR, but will wait for feedback before proceeding, because "Type" is present many places :)

  • 🇷🇴Romania bbu23

    I have to admit it sounds much better 😁

    You have the green light, I like how it sounds and it makes total sense. To think about it, I had a bit of troubles finding names for that I think I just went with the actual name of the entity type. So, please proceed, and then we need to update README as well, and when I do the release we need to update the Documentation, and with occasion update the screenshots for the other feedback as well from the Documentation (the one you mentioned about the IDs naming).

    Thank you

  • 🇩🇰Denmark ressa Copenhagen

    Great, I really appreciate your openness to changes :)

    While creating the issue, my mind also glazed over a few times, having to juggle the different concepts ... which made me realize that while actually coding it, something similar probably was taking place. Naming things are difficult!

    But let's keep using "type" in the code, and only update the UI and README, right?

    And then doing the documentation when that's in place is a great plan, and I have added it in the Issue Summary.

  • 🇩🇰Denmark ressa Copenhagen

    I created a child issue 📌 Update documentation, using Menu instead of Type Active .

  • 🇩🇰Denmark ressa Copenhagen
  • 🇷🇴Romania bbu23

    Hahah, yes the naming sometimes can be the harder part!

    Sure, sounds like a plan! Thank you!

  • 🇩🇰Denmark ressa Copenhagen
  • 🇩🇰Denmark ressa Copenhagen

    I had a look at it, and it may be a pretty big task ... Below (see section "1. UI occurrences ...") public facing strings in the UI, which need to be updated are listed.

    I also include the occurrences of "type" which probably don't need to be updated in section 2 and 3, since they are code, and not exposed via the GUI or Drush.

    The strings and files which need to be updated include permissions, since they are exposed in the GUI. I guess this would mean update hooks are also needed?

    Perhaps this is too much work, for too little gain? We could set this to Postponed, so that anyone who feels like it in the future, can take a stab at it :)

    1. UI occurrences where "type" could be updated

      ./menu_migration.links.action.yml:  title: 'Add export type'
      ./menu_migration.links.action.yml:  title: 'Add import type'
      ./menu_migration.links.menu.yml:  title: 'Export Types'
      ./menu_migration.links.menu.yml:  title: 'Import Types'
      ./menu_migration.links.task.yml:  title: 'Export types'
      ./menu_migration.links.task.yml:  title: 'Import types'
      ./menu_migration.module:      $output .= '<dd>' . t('1. drush mme EXPORT_TYPE_ID: Executes the export for the given Export Type ID. Requires confirmation') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('1. drush mmel: Lists all the available Export Types that are compatible with Drush') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('1. drush mmi IMPORT_TYPE_ID: Executes the import for the given Import Type ID. Requires confirmation') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('1. drush mmil: Lists all the available Import Types that are compatible with Drush') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('1. Navigate to Configuration → Development → Menu Migration → Export Types') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('1. Navigate to Configuration → Development → Menu Migration → Import Types') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('1. Once you have at least one, navigate to Configuration → Development → Menu Migration → Export Types') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('1. Once you have at least one, navigate to Configuration → Development → Menu Migration → Import Types') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('2. Click on Add export type and fill out the form') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('2. Click on Add import type and fill out the form') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('3. The Export type name can be anything relevant to you') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('3. The Import type name can be anything relevant to you') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('4. The machine name will be the ID of the export type and will be used with Drush') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('4. The machine name will be the ID of the import type and will be used with Drush') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('Export types allow executing menu exports from the database to a selected Destination.') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('Exports can be executed from any Export Type entity.') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('Import types allow executing menu imports from a selected source to the database.') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('Imports can be executed from any Import Type entity.') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('You can add as many Export Types as you wish, and you can organize them based on how you plan to use them.') . '</dd>';
      ./menu_migration.module:      $output .= '<dd>' . t('You can add as many Import Types as you wish, and you can organize them based on how you plan to use them.') . '</dd>';
      ./menu_migration.module:      $output .= '<dt>' . t('Defining export types') . '</dt>';
      ./menu_migration.module:      $output .= '<dt>' . t('Defining import types') . '</dt>';
      ./menu_migration.permissions.yml:  description: 'Access to the Export Types page and perform exports.'
      ./menu_migration.permissions.yml:  description: 'Access to the Import Types page and perform imports.'
      ./menu_migration.permissions.yml:  description: 'Administer Export Types: add, edit, delete, export.'
      ./menu_migration.permissions.yml:  description: 'Administer Import Types: add, edit, delete, import.'
      ./menu_migration.permissions.yml:  title: 'Administer export types'
      ./menu_migration.permissions.yml:  title: 'Administer import types'
      ./menu_migration.permissions.yml:  title: 'Perform export on any Export Types'
      ./menu_migration.permissions.yml:  title: 'Perform import on any Import Types'
      ./menu_migration.permissions.yml:administer menu migration export types:
      ./menu_migration.permissions.yml:administer menu migration import types:
      ./README.md:# Export the Export Type with ID my_export_id, and skip confirmation question.
      ./README.md:# Export the Export Type with ID my_export_id.
      ./README.md:# Import the Import Type with ID my_import_id, and skip the confirmation question.
      ./README.md:# Import the Import Type with ID my_import_id.
      ./README.md:### Defining an export type
      ./README.md:### Defining an import type
      ./README.md:1. Export Types - allows defining export types that can later trigger exports
      ./README.md:1. Navigate to Configuration → Development → Menu Migration → Export Types
      ./README.md:1. Navigate to Configuration → Development → Menu Migration → Export Types
      ./README.md:1. Navigate to Configuration → Development → Menu Migration → Import Types
      ./README.md:1. Navigate to Configuration → Development → Menu Migration → Import Types
      ./README.md:2. Click on _Add export type_ and fill out the form
      ./README.md:2. Click on _Add Import type_ and fill out the form
      ./README.md:2. Here you have a listing of the available export types
      ./README.md:2. Here you have a listing of the available import types
      ./README.md:2. Import Types - allows defining import types that can later trigger imports
      ./README.md:3. In the _Operations_ column, click on _Export_ for one of the export types
      ./README.md:3. In the _Operations_ column, click on _Import_ for one of the export types
      ./README.md:3. The _Export type name_ can be anything relevant to you
      ./README.md:3. The _Import type name_ can be anything relevant to you
      ./README.md:4. The machine name will be the ID of the export type and will be used with
      ./README.md:4. The machine name will be the ID of the Import type and will be used with
      ./README.md:In order to perform a menu export, an export type needs to be created.
      ./README.md:In order to perform a menu import, an import type needs to be created.
      ./README.md:Lists all the available export types that support Drush.
      ./README.md:Lists all the available import types that support Drush.
      ./README.md:Performs the export for the given export type ID. Requires confirmation.
      ./README.md:Performs the import for the given export type ID. Requires confirmation.
      ./README.md:types and import types.
      ./README.md:| ` administer menu migration export types ` | Administer export types            | Administer Export Types: add, edit, delete, export. Anything related to Export Types. |
      ./README.md:| ` administer menu migration import types ` | Administer import types            | Administer Import Types: add, edit, delete, export. Anything related to Import Types. |
      ./README.md:| ` perform export on menu migrations `      | Perform export on any Export Types | Access to the Export Types listing page and permission to perform exports.            |
      ./README.md:| ` perform import on menu migrations `      | Perform import on any Import Types | Access to the Export Types listing page and permission to perform imports.            |
      ./src/Commands/MenuMigrationCommands.php:          $this->io()->error(dt('The "!arg" Export Type does not support drush. Use drush mmel to see the supported IDs.', [
      ./src/Commands/MenuMigrationCommands.php:          $this->io()->error(dt('The "!arg" Import Type does not support drush. Use drush mmil to see the supported IDs.', [
      ./src/Commands/MenuMigrationCommands.php:        $this->io()->error(dt('The "!arg" Export Type does not exist. Please enter a valid Export Type.', ['!arg' => $export_type]));
      ./src/Commands/MenuMigrationCommands.php:        $this->io()->error(dt('The "!arg" Import Type does not exist. Please enter a valid Import Type.', ['!arg' => $import_type]));
      ./src/Commands/MenuMigrationCommands.php:      $this->io()->error(dt('You must specify the ID of the Export Type. Use drush mmel to see the available IDs.'));
      ./src/Commands/MenuMigrationCommands.php:      $this->io()->error(dt('You must specify the ID of the Import Type. Use drush mmil to see the available IDs.'));
      ./src/Commands/MenuMigrationCommands.php:   * If there aren't any export types available, or none of the existing ones
      ./src/Commands/MenuMigrationCommands.php:   * If there aren't any import types available, or none of the existing ones
      ./src/Entity/ExportType.php: *     plural = "@count export types",
      ./src/Entity/ExportType.php: *     singular = "@count export type",
      ./src/Entity/ExportType.php: *   admin_permission = "administer menu migration export types",
      ./src/Entity/ExportType.php: *   label = @Translation("Export type"),
      ./src/Entity/ExportType.php: *   label_collection = @Translation("Export types"),
      ./src/Entity/ExportType.php: *   label_plural = @Translation("export types"),
      ./src/Entity/ExportType.php: *   label_singular = @Translation("export type"),
      ./src/Entity/ImportType.php: *     plural = "@count import types",
      ./src/Entity/ImportType.php: *     singular = "@count import type",
      ./src/Entity/ImportType.php: *   admin_permission = "administer menu migration import types",
      ./src/Entity/ImportType.php: *   label = @Translation("Import type"),
      ./src/Entity/ImportType.php: *   label_collection = @Translation("Import types"),
      ./src/Entity/ImportType.php: *   label_plural = @Translation("import types"),
      ./src/Entity/ImportType.php: *   label_singular = @Translation("import type"),
      ./src/Form/Entity/ExportTypeAddForm.php:    $actions['submit']['#value'] = $this->t('Create new export type');
      ./src/Form/Entity/ExportTypeAddForm.php:    $this->messenger()->addStatus($this->t('The export type %name was created.', ['%name' => $this->entity->label()]));
      ./src/Form/Entity/ExportTypeEditForm.php:    $this->messenger()->addStatus($this->t('The export type %name was successfully updated.', ['%name' => $this->entity->label()]));
      ./src/Form/Entity/ExportTypeFormBase.php:      '#title' => $this->t('Export type name'),
      ./src/Form/Entity/ImportTypeAddForm.php:    $actions['submit']['#value'] = $this->t('Create new import type');
      ./src/Form/Entity/ImportTypeAddForm.php:    $this->messenger()->addStatus($this->t('The import type %name was created.', ['%name' => $this->entity->label()]));
      ./src/Form/Entity/ImportTypeEditForm.php:    $this->messenger()->addStatus($this->t('The import type %name was successfully updated.', ['%name' => $this->entity->label()]));
      ./src/Form/Entity/ImportTypeFormBase.php:      '#title' => $this->t('Import type name'),
      
    2. Code comments occurrences of "type"

      ./assets/js/clipboard.js:   * Copies the drush commands to clipboard in the import/export types listings.
      ./menu_migration.install: * Install the Export & Import configuration entity types.
      ./src/Access/ImportExportAccessControlHandler.php: * Provides an entity access control handler for export types & import types.
      ./src/Commands/MenuMigrationCommands.php:   *   Export the configured menu(s) in the Export Type with my_export_type ID.
      ./src/Commands/MenuMigrationCommands.php:   *   Import the configured menu(s) in the Import Type with my_import_type ID.
      ./src/Commands/MenuMigrationCommands.php:   *   List all the available export types that are compatible with Drush.
      ./src/Commands/MenuMigrationCommands.php:   *   List all the available import types that are compatible with Drush.
      ./src/Commands/MenuMigrationCommands.php:   *   The machine name (ID) of the Export Type.
      ./src/Commands/MenuMigrationCommands.php:   *   The machine name (ID) of the Import Type.
      ./src/Commands/MenuMigrationCommands.php:   * Exports one or more menu items using the given export type ID.
      ./src/Commands/MenuMigrationCommands.php:   * Imports one or more menu items using the given import type ID.
      ./src/Commands/MenuMigrationCommands.php:   * Lists the available export types.
      ./src/Commands/MenuMigrationCommands.php:   * Lists the available import types.
      ./src/Commands/MenuMigrationCommands.php:   * The Export Type entity storage.
      ./src/Commands/MenuMigrationCommands.php:   * The Import Type entity storage.
      ./src/Entity/ExportType.php:   * The displayed name of the Export Type.
      ./src/Entity/ExportType.php: * Defines an export type configuration entity.
      ./src/Entity/ExportTypeInterface.php: * Interface for the Export Type configuration entity.
      ./src/Entity/ImportType.php:   * The displayed name of the Import Type.
      ./src/Entity/ImportType.php: * Defines an import type configuration entity.
      ./src/Entity/ImportTypeInterface.php: * Interface for the Import Type configuration entity.
      ./src/ExportTypeListBuilder.php: * Builds a listing of export type entities.
      ./src/Form/Entity/ExportTypeAddForm.php: * Provides a form for creating export types.
      ./src/Form/Entity/ExportTypeDeleteForm.php: * Provides a form for deleting export types.
      ./src/Form/Entity/ExportTypeEditForm.php: * Provides a form for editing export types.
      ./src/Form/Entity/ExportTypeExportForm.php: * Provides a form for exporting export types.
      ./src/Form/Entity/ExportTypeFormBase.php:   * The export type entity.
      ./src/Form/Entity/ExportTypeFormBase.php:   * The export type storage.
      ./src/Form/Entity/ExportTypeFormBase.php: * Provides a form base for creating and editing export types.
      ./src/Form/Entity/ImportTypeAddForm.php: * Provides a form for creating import types.
      ./src/Form/Entity/ImportTypeDeleteForm.php: * Provides a form for deleting import types.
      ./src/Form/Entity/ImportTypeEditForm.php: * Provides a form for editing import types.
      ./src/Form/Entity/ImportTypeFormBase.php:   * The import type entity.
      ./src/Form/Entity/ImportTypeFormBase.php:   * The import type storage.
      ./src/Form/Entity/ImportTypeFormBase.php: * Provides a form base for creating and editing import types.
      ./src/Form/Entity/ImportTypeImportForm.php: * Provides a form for importing import types.
      ./src/ImportExportListBuilderBase.php:   *   The Export Type or Import Type entity.
      ./src/ImportExportListBuilderBase.php: * Base entity list builder for import type and export type entities.
      ./src/ImportExportRouteProvider.php: * Provides HTML routes for export type & import type pages.
      ./src/ImportTypeListBuilder.php: * Defines a class to build a listing of import type entities.
      ./src/Plugin/FormatInterface.php:   * Gets the mime type of the file for downloadable exports.
      ./src/Plugin/FormatInterface.php:   * know if in the future it might conflict with new types or formats or not.
      ./src/Plugin/ImportExportActionPluginInterface.php: * This is used as an addition to the import & export types entity forms,
      ./src/Service/MenuMigrationService.php:   * The entity type manager service.
      
    3. Code occurrences of "type"

      ./.git/hooks/pre-commit.sample:allownonascii=$(git config --type=bool hooks.allownonascii)
      ./.git/hooks/update.sample:   echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
      ./.git/hooks/update.sample: newrev_type=$(git cat-file -t $newrev)
      ./.git/hooks/update.sample: newrev_type=delete
      ./.git/hooks/update.sample:# --- Check types
      ./.git/hooks/update.sample:allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
      ./.git/hooks/update.sample:allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
      ./.git/hooks/update.sample:allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
      ./.git/hooks/update.sample:allowunannotated=$(git config --type=bool hooks.allowunannotated)
      ./.git/hooks/update.sample:case "$refname","$newrev_type" in
      ./.git/hooks/update.sample:denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
      ./assets/js/clipboard.js:        tempItem.setAttribute('type','text');
      ./assets/js/clipboard.js:   * @type {Drupal~behavior}
      ./composer.json:    "type": "drupal-module",
      ./drush.services.yml:    arguments: [ '@entity_type.manager' ]
      ./menu_migration.info.yml:type: module
      ./menu_migration.install:      $update_manager->installEntityType($entity_type);
      ./menu_migration.install:    if ($entity_type->getProvider() == 'menu_migration') {
      ./menu_migration.install:  foreach (\Drupal::entityTypeManager()->getDefinitions() as $entity_type) {
      ./menu_migration.links.action.yml:    - entity.mm_export_type.collection
      ./menu_migration.links.action.yml:    - entity.mm_import_type.collection
      ./menu_migration.links.action.yml:  route_name: entity.mm_export_type.add_form
      ./menu_migration.links.action.yml:  route_name: entity.mm_import_type.add_form
      ./menu_migration.links.action.yml:mm_export_type_add_action:
      ./menu_migration.links.action.yml:mm_import_type_add_action:
      ./menu_migration.links.menu.yml:  route_name: entity.mm_export_type.collection
      ./menu_migration.links.menu.yml:  route_name: entity.mm_import_type.collection
      ./menu_migration.links.menu.yml:menu_migration.export_types:
      ./menu_migration.links.menu.yml:menu_migration.import_types:
      ./menu_migration.links.task.yml:  route_name: entity.mm_export_type.collection
      ./menu_migration.links.task.yml:  route_name: entity.mm_import_type.collection
      ./menu_migration.links.task.yml:menu_migration.export_types:
      ./menu_migration.links.task.yml:menu_migration.import_types:
      ./menu_migration.services.yml:    arguments: [ '@entity_type.manager', '@menu.link_tree', '@event_dispatcher', '@language_manager', '@logger.factory' ]
      ./README.md:    // Here you add the default file mimetype for exports like download. If
      ./README.md:  public function mimeType() {
      ./src/Access/ImportExportAccessControlHandler.php:      || $account->hasPermission($this->entityType->getAdminPermission())) {
      ./src/Annotation/MenuMigrationDestination.php:   * The human-readable name of the ExportDestination type.
      ./src/Annotation/MenuMigrationFormat.php:   * The human-readable name of the Format type.
      ./src/Annotation/MenuMigrationSource.php:   * The human-readable name of the ImportSource type.
      ./src/Commands/MenuMigrationCommands.php:            $result = $exportType->export();
      ./src/Commands/MenuMigrationCommands.php:            $result = $importType->import();
      ./src/Commands/MenuMigrationCommands.php:            '!arg' => $export_type,
      ./src/Commands/MenuMigrationCommands.php:            '!arg' => $import_type,
      ./src/Commands/MenuMigrationCommands.php:          $exportDescription = $exportType->getDestinationPlugin()->getExportDescription();
      ./src/Commands/MenuMigrationCommands.php:          $exportType->getCommand(),
      ./src/Commands/MenuMigrationCommands.php:          $exportType->id(),
      ./src/Commands/MenuMigrationCommands.php:          $exportType->label(),
      ./src/Commands/MenuMigrationCommands.php:          $importDescription = $importType->getSourcePlugin()->getImportDescription();
      ./src/Commands/MenuMigrationCommands.php:          $importType->getCommand(),
      ./src/Commands/MenuMigrationCommands.php:          $importType->id(),
      ./src/Commands/MenuMigrationCommands.php:          $importType->label(),
      ./src/Commands/MenuMigrationCommands.php:          implode(', ', $exportType->getMenus()),
      ./src/Commands/MenuMigrationCommands.php:          implode(', ', $importType->getMenus()),
      ./src/Commands/MenuMigrationCommands.php:        $destination = $exportType->getDestinationPlugin();
      ./src/Commands/MenuMigrationCommands.php:        $source = $importType->getSourcePlugin();
      ./src/Commands/MenuMigrationCommands.php:        $types[] = [
      ./src/Commands/MenuMigrationCommands.php:        $types[] = [
      ./src/Commands/MenuMigrationCommands.php:        if (!$exportType->handleCli()) {
      ./src/Commands/MenuMigrationCommands.php:        if (!$importType->handleCli()) {
      ./src/Commands/MenuMigrationCommands.php:      $exportType = $this->exportTypeStorage->load($export_type);
      ./src/Commands/MenuMigrationCommands.php:      $importType = $this->importTypeStorage->load($import_type);
      ./src/Commands/MenuMigrationCommands.php:      if ($exportType instanceof ExportTypeInterface) {
      ./src/Commands/MenuMigrationCommands.php:      if ($exportType->handleCli()) {
      ./src/Commands/MenuMigrationCommands.php:      if ($importType instanceof ImportTypeInterface) {
      ./src/Commands/MenuMigrationCommands.php:      if ($importType->handleCli()) {
      ./src/Commands/MenuMigrationCommands.php:    $exportTypes = $this->exportTypeStorage->loadMultiple();
      ./src/Commands/MenuMigrationCommands.php:    $importTypes = $this->importTypeStorage->loadMultiple();
      ./src/Commands/MenuMigrationCommands.php:    $this->exportTypeStorage = $entityTypeManager->getStorage('mm_export_type');
      ./src/Commands/MenuMigrationCommands.php:    $this->importTypeStorage = $entityTypeManager->getStorage('mm_import_type');
      ./src/Commands/MenuMigrationCommands.php:    $this->io()->table($headers, $types);
      ./src/Commands/MenuMigrationCommands.php:    $this->io()->table($headers, $types);
      ./src/Commands/MenuMigrationCommands.php:    $types = [];
      ./src/Commands/MenuMigrationCommands.php:    $types = [];
      ./src/Commands/MenuMigrationCommands.php:    /** @var \Drupal\menu_migration\Entity\ExportTypeInterface[] $exportTypes */
      ./src/Commands/MenuMigrationCommands.php:    /** @var \Drupal\menu_migration\Entity\ImportTypeInterface[] $importTypes */
      ./src/Commands/MenuMigrationCommands.php:    foreach ($exportTypes as $exportType) {
      ./src/Commands/MenuMigrationCommands.php:    foreach ($importTypes as $importType) {
      ./src/Commands/MenuMigrationCommands.php:    if (empty($export_type)) {
      ./src/Commands/MenuMigrationCommands.php:    if (empty($import_type)) {
      ./src/Commands/MenuMigrationCommands.php:   * @param string $export_type
      ./src/Commands/MenuMigrationCommands.php:   * @param string $import_type
      ./src/Commands/MenuMigrationCommands.php:   * @usage menu_migration:export my_export_type
      ./src/Commands/MenuMigrationCommands.php:   * @usage menu_migration:import my_import_type
      ./src/Commands/MenuMigrationCommands.php:  protected EntityStorageInterface $exportTypeStorage;
      ./src/Commands/MenuMigrationCommands.php:  protected EntityStorageInterface $importTypeStorage;
      ./src/Commands/MenuMigrationCommands.php:  public function __construct(EntityTypeManagerInterface $entityTypeManager) {
      ./src/Commands/MenuMigrationCommands.php:  public function export(string $export_type = '') {
      ./src/Commands/MenuMigrationCommands.php:  public function import(string $import_type = '') {
      ./src/Commands/MenuMigrationCommands.php:use Drupal\Core\Entity\EntityTypeManagerInterface;
      ./src/Commands/MenuMigrationCommands.php:use Drupal\menu_migration\Entity\ExportTypeInterface;
      ./src/Commands/MenuMigrationCommands.php:use Drupal\menu_migration\Entity\ImportTypeInterface;
      ./src/Entity/ExportType.php:      $config['#export_type'] = $this;
      ./src/Entity/ExportType.php: *       "add" = "Drupal\menu_migration\Form\Entity\ExportTypeAddForm",
      ./src/Entity/ExportType.php: *       "delete" = "Drupal\menu_migration\Form\Entity\ExportTypeDeleteForm",
      ./src/Entity/ExportType.php: *       "edit" = "Drupal\menu_migration\Form\Entity\ExportTypeEditForm",
      ./src/Entity/ExportType.php: *       "export" = "Drupal\menu_migration\Form\Entity\ExportTypeExportForm"
      ./src/Entity/ExportType.php: *     "add-form" = "/admin/config/development/menu-migration/export-types/add",
      ./src/Entity/ExportType.php: *     "collection" = "/admin/config/development/menu-migration/export-types",
      ./src/Entity/ExportType.php: *     "delete-form" = "/admin/config/development/menu-migration/export-types/{mm_export_type}/delete",
      ./src/Entity/ExportType.php: *     "edit-form" = "/admin/config/development/menu-migration/export-types/{mm_export_type}/edit",
      ./src/Entity/ExportType.php: *     "export-form" = "/admin/config/development/menu-migration/export-types/{mm_export_type}/export",
      ./src/Entity/ExportType.php: *     "list_builder" = "Drupal\menu_migration\ExportTypeListBuilder",
      ./src/Entity/ExportType.php: *   id = "mm_export_type",
      ./src/Entity/ExportType.php: * @ConfigEntityType(
      ./src/Entity/ExportType.php:class ExportType extends ConfigEntityBase implements ExportTypeInterface {
      ./src/Entity/ExportTypeInterface.php:interface ExportTypeInterface extends ConfigEntityInterface {
      ./src/Entity/ImportType.php:      $config['#import_type'] = $this;
      ./src/Entity/ImportType.php: *       "add" = "Drupal\menu_migration\Form\Entity\ImportTypeAddForm",
      ./src/Entity/ImportType.php: *       "delete" = "Drupal\menu_migration\Form\Entity\ImportTypeDeleteForm",
      ./src/Entity/ImportType.php: *       "edit" = "Drupal\menu_migration\Form\Entity\ImportTypeEditForm",
      ./src/Entity/ImportType.php: *       "import" = "Drupal\menu_migration\Form\Entity\ImportTypeImportForm"
      ./src/Entity/ImportType.php: *     "add-form" = "/admin/config/development/menu-migration/import-types/add",
      ./src/Entity/ImportType.php: *     "collection" = "/admin/config/development/menu-migration/import-types",
      ./src/Entity/ImportType.php: *     "delete-form" = "/admin/config/development/menu-migration/import-types/{mm_import_type}/delete",
      ./src/Entity/ImportType.php: *     "edit-form" = "/admin/config/development/menu-migration/import-types/{mm_import_type}/edit",
      ./src/Entity/ImportType.php: *     "import-form" = "/admin/config/development/menu-migration/import-types/{mm_import_type}/import",
      ./src/Entity/ImportType.php: *     "list_builder" = "Drupal\menu_migration\ImportTypeListBuilder",
      ./src/Entity/ImportType.php: *   id = "mm_import_type",
      ./src/Entity/ImportType.php: * @ConfigEntityType(
      ./src/Entity/ImportType.php:class ImportType extends ConfigEntityBase implements ImportTypeInterface {
      ./src/Entity/ImportTypeInterface.php:interface ImportTypeInterface extends ConfigEntityInterface {
      ./src/ExportTypeListBuilder.php:  public function buildRow(EntityInterface|ExportTypeInterface $entity) {
      ./src/ExportTypeListBuilder.php:class ExportTypeListBuilder extends ImportExportListBuilderBase {
      ./src/ExportTypeListBuilder.php:use Drupal\menu_migration\Entity\ExportTypeInterface;
      ./src/Form/Entity/ExportTypeAddForm.php:class ExportTypeAddForm extends ExportTypeFormBase {
      ./src/Form/Entity/ExportTypeDeleteForm.php:class ExportTypeDeleteForm extends EntityDeleteForm {}
      ./src/Form/Entity/ExportTypeEditForm.php:class ExportTypeEditForm extends ExportTypeFormBase {
      ./src/Form/Entity/ExportTypeExportForm.php:      '#type' => 'container',
      ./src/Form/Entity/ExportTypeExportForm.php:   * @var \Drupal\menu_migration\Entity\ExportType
      ./src/Form/Entity/ExportTypeExportForm.php:class ExportTypeExportForm extends EntityConfirmFormBase {
      ./src/Form/Entity/ExportTypeFormBase.php:        'exists' => [$this->exportTypeStorage, 'load'],
      ./src/Form/Entity/ExportTypeFormBase.php:      $container->get('entity_type.manager'),
      ./src/Form/Entity/ExportTypeFormBase.php:      '#type' => 'container',
      ./src/Form/Entity/ExportTypeFormBase.php:      '#type' => 'machine_name',
      ./src/Form/Entity/ExportTypeFormBase.php:      '#type' => 'select',
      ./src/Form/Entity/ExportTypeFormBase.php:      '#type' => 'textfield',
      ./src/Form/Entity/ExportTypeFormBase.php:    $this->exportTypeStorage = $entityTypeManager->getStorage('mm_export_type');
      ./src/Form/Entity/ExportTypeFormBase.php:   * @var \Drupal\menu_migration\Entity\ExportType
      ./src/Form/Entity/ExportTypeFormBase.php:  protected EntityStorageInterface $exportTypeStorage;
      ./src/Form/Entity/ExportTypeFormBase.php:  public function __construct(ExportDestinationManager $destinationManager, EntityTypeManagerInterface $entityTypeManager) {
      ./src/Form/Entity/ExportTypeFormBase.php:class ExportTypeFormBase extends EntityForm {
      ./src/Form/Entity/ExportTypeFormBase.php:use Drupal\Core\Entity\EntityTypeManagerInterface;
      ./src/Form/Entity/ImportTypeAddForm.php:class ImportTypeAddForm extends ImportTypeFormBase {
      ./src/Form/Entity/ImportTypeDeleteForm.php:class ImportTypeDeleteForm extends EntityDeleteForm {}
      ./src/Form/Entity/ImportTypeEditForm.php:class ImportTypeEditForm extends ImportTypeFormBase {
      ./src/Form/Entity/ImportTypeFormBase.php:        'exists' => [$this->importTypeStorage, 'load'],
      ./src/Form/Entity/ImportTypeFormBase.php:      $container->get('entity_type.manager'),
      ./src/Form/Entity/ImportTypeFormBase.php:      '#type' => 'container',
      ./src/Form/Entity/ImportTypeFormBase.php:      '#type' => 'machine_name',
      ./src/Form/Entity/ImportTypeFormBase.php:      '#type' => 'select',
      ./src/Form/Entity/ImportTypeFormBase.php:      '#type' => 'textfield',
      ./src/Form/Entity/ImportTypeFormBase.php:    $this->importTypeStorage = $entityTypeManager->getStorage('mm_import_type');
      ./src/Form/Entity/ImportTypeFormBase.php:   * @var \Drupal\menu_migration\Entity\ImportType
      ./src/Form/Entity/ImportTypeFormBase.php:  protected EntityStorageInterface $importTypeStorage;
      ./src/Form/Entity/ImportTypeFormBase.php:  public function __construct(ImportSourceManager $sourceManager, EntityTypeManagerInterface $entityTypeManager) {
      ./src/Form/Entity/ImportTypeFormBase.php:class ImportTypeFormBase extends EntityForm {
      ./src/Form/Entity/ImportTypeFormBase.php:use Drupal\Core\Entity\EntityTypeManagerInterface;
      ./src/Form/Entity/ImportTypeImportForm.php:      '#type' => 'container',
      ./src/Form/Entity/ImportTypeImportForm.php:   * @var \Drupal\menu_migration\Entity\ImportType
      ./src/Form/Entity/ImportTypeImportForm.php:class ImportTypeImportForm extends EntityConfirmFormBase {
      ./src/ImportExportListBuilderBase.php:      $container->get('entity_type.manager')->getStorage($entity_type->id()),
      ./src/ImportExportListBuilderBase.php:      $entity_type,
      ./src/ImportExportListBuilderBase.php:    parent::__construct($entity_type, $storage);
      ./src/ImportExportListBuilderBase.php:   * @param \Drupal\Core\Entity\EntityInterface|\Drupal\menu_migration\Entity\ExportTypeInterface|\Drupal\menu_migration\Entity\ImportTypeInterface $entity
      ./src/ImportExportListBuilderBase.php:  protected function getFormattedEntityCommand(EntityInterface|ExportTypeInterface|ImportTypeInterface $entity) {
      ./src/ImportExportListBuilderBase.php:  public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, ModuleExtensionList $moduleExtensionList, FileUrlGeneratorInterface $fileUrlGenerator) {
      ./src/ImportExportListBuilderBase.php:  public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
      ./src/ImportExportListBuilderBase.php:use Drupal\Core\Entity\EntityTypeInterface;
      ./src/ImportExportListBuilderBase.php:use Drupal\menu_migration\Entity\ExportTypeInterface;
      ./src/ImportExportListBuilderBase.php:use Drupal\menu_migration\Entity\ImportTypeInterface;
      ./src/ImportExportRouteProvider.php:          $entity_type_id => ['type' => 'entity:' . $entity_type_id],
      ./src/ImportExportRouteProvider.php:          $entity_type_id => ['type' => 'entity:' . $entity_type_id],
      ./src/ImportExportRouteProvider.php:          '_entity_form' => "{$entity_type_id}.{$operation}",
      ./src/ImportExportRouteProvider.php:          '_entity_form' => "{$entity_type_id}.{$operation}",
      ./src/ImportExportRouteProvider.php:        ->setRequirement('_entity_access', "{$entity_type_id}.{$operation}")
      ./src/ImportExportRouteProvider.php:        ->setRequirement('_entity_access', "{$entity_type_id}.{$operation}")
      ./src/ImportExportRouteProvider.php:      $collection->add("entity.{$entity_type_id}.export_form", $exportFormRoute);
      ./src/ImportExportRouteProvider.php:      $collection->add("entity.{$entity_type_id}.import_form", $importFormRoute);
      ./src/ImportExportRouteProvider.php:      $entity_type_id = $entity_type->id();
      ./src/ImportExportRouteProvider.php:      $entity_type_id = $entity_type->id();
      ./src/ImportExportRouteProvider.php:      $route = new Route($entity_type->getLinkTemplate('export-form'));
      ./src/ImportExportRouteProvider.php:      $route = new Route($entity_type->getLinkTemplate('import-form'));
      ./src/ImportExportRouteProvider.php:      if ($entity_type->getFormClass('export')) {
      ./src/ImportExportRouteProvider.php:      if ($entity_type->getFormClass('import')) {
      ./src/ImportExportRouteProvider.php:    $collection = parent::getRoutes($entity_type);
      ./src/ImportExportRouteProvider.php:    $entity_type_id = $entity_type->id();
      ./src/ImportExportRouteProvider.php:    if ($entity_type->hasLinkTemplate('export-form')) {
      ./src/ImportExportRouteProvider.php:    if ($entity_type->hasLinkTemplate('import-form')) {
      ./src/ImportExportRouteProvider.php:    if ($exportFormRoute = $this->getExportFormRoute($entity_type)) {
      ./src/ImportExportRouteProvider.php:    if ($importFormRoute = $this->getImportFormRoute($entity_type)) {
      ./src/ImportExportRouteProvider.php:    if ($route = parent::getCollectionRoute($entity_type)) {
      ./src/ImportExportRouteProvider.php:   *   The entity type.
      ./src/ImportExportRouteProvider.php:   *   The entity type.
      ./src/ImportExportRouteProvider.php:   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
      ./src/ImportExportRouteProvider.php:   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
      ./src/ImportExportRouteProvider.php:  protected function getCollectionRoute(EntityTypeInterface $entity_type) {
      ./src/ImportExportRouteProvider.php:  protected function getExportFormRoute(EntityTypeInterface $entity_type) {
      ./src/ImportExportRouteProvider.php:  protected function getImportFormRoute(EntityTypeInterface $entity_type) {
      ./src/ImportExportRouteProvider.php:  public function getRoutes(EntityTypeInterface $entity_type) {
      ./src/ImportExportRouteProvider.php:use Drupal\Core\Entity\EntityTypeInterface;
      ./src/ImportTypeListBuilder.php:  public function buildRow(EntityInterface|ImportTypeInterface $entity) {
      ./src/ImportTypeListBuilder.php: * @see \Drupal\menu_migration\Entity\ImportType
      ./src/ImportTypeListBuilder.php:class ImportTypeListBuilder extends ImportExportListBuilderBase {
      ./src/ImportTypeListBuilder.php:use Drupal\menu_migration\Entity\ImportTypeInterface;
      ./src/Plugin/FormatInterface.php:   *   A string with the file mime type.
      ./src/Plugin/FormatInterface.php:  public function mimeType();
      ./src/Plugin/ImportExportPluginBase.php:      '#type' => $this->handleMultiple() ? 'checkboxes' : 'radios',
      ./src/Plugin/ImportExportPluginBase.php:      '#type' => 'select',
      ./src/Plugin/menu_migration/ExportDestination/Codebase.php:      '#type' => 'textfield',
      ./src/Plugin/menu_migration/ExportDestination/Download.php:      ':url' => $exportType->toUrl('collection')->toString(),
      ./src/Plugin/menu_migration/ExportDestination/Download.php:    $exportType = $configuration['#export_type'];
      ./src/Plugin/menu_migration/ExportDestination/Download.php:    $response->headers->set('Content-Type', $this->formatPlugin->mimeType());
      ./src/Plugin/menu_migration/ExportDestination/Download.php:    /** @var \Drupal\menu_migration\Entity\ExportTypeInterface $exportType */
      ./src/Plugin/menu_migration/Format/JsonFormat.php:  public function mimeType() {
      ./src/Plugin/menu_migration/Format/YamlFormat.php:    // @todo Not sure what the good mimetype is, using text for now.
      ./src/Plugin/menu_migration/Format/YamlFormat.php:  public function mimeType() {
      ./src/Plugin/menu_migration/ImportSource/Codebase.php:      '#type' => 'textfield',
      ./src/Plugin/menu_migration/ImportSource/FileUpload.php:      '#type' => 'file',
      ./src/Service/MenuMigrationService.php:        $menuLinkContent = $this->entityTypeManager->getStorage('menu_link_content')->load($definition['metadata']['entity_id']);
      ./src/Service/MenuMigrationService.php:    $availableMenus = $this->entityTypeManager->getStorage('menu')->loadMultiple();
      ./src/Service/MenuMigrationService.php:    $existingItems = $this->entityTypeManager->getStorage('menu_link_content')->loadByProperties(['menu_name' => $menuName]);
      ./src/Service/MenuMigrationService.php:    $this->entityTypeManager = $entityTypeManager;
      ./src/Service/MenuMigrationService.php:   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
      ./src/Service/MenuMigrationService.php:   * The entity type manager service.
      ./src/Service/MenuMigrationService.php:  protected EntityTypeManagerInterface $entityTypeManager;
      ./src/Service/MenuMigrationService.php:  public function __construct(EntityTypeManagerInterface $entityTypeManager, MenuLinkTreeInterface $menuLinkTree, EventDispatcherInterface $eventDispatcher, LanguageManagerInterface $languageManager, LoggerChannelFactoryInterface $logger) {
      ./src/Service/MenuMigrationService.php:use Drupal\Core\Entity\EntityTypeManagerInterface;
      
  • 🇷🇴Romania bbu23

    Thank you for your analysis, but I wouldn't go that far. I don't want to change what a user cannot see.
    But I do agree with the naming in the UI, now I will review this and take a decision.

  • 🇩🇰Denmark ressa Copenhagen

    I don't want to change what a user cannot see.

    I agree with that, and also what I tried to say ... sorry if I did not express myself clearly.

    I do not propose to update code or code comments (#2 and #3 -- as I wrote "...which probably don't need to be updated"), but only strings which the user can see through the GUI or Drush, which is section #1, "1. UI occurrences where "type" could be updated".

    From what I can tell, all the 103 lines of code under section #1 can be exposed to the user. Or maybe I am missing something ...

    But maybe that is doable after all?

    I do think switching from "type" to "menu" would be an improvement, and more user friendly. But it all comes down to how big an effort it takes ... I'll let you decide, if it's worth it :)

  • 🇷🇴Romania bbu23

    Yes, I might have included extra concerns unnecessarily. :)

    Based on your research, indeed it requires many changes if we tackle every occurrence. I'll be thinking of it, I also agree about the effort, so we'll have to see. It's definitely doable, but it's very time consuming as you mentioned.

  • 🇩🇰Denmark ressa Copenhagen

    Heh, a little extra concern can sometimes be a good thing :)

    It sounds great, that you will think about it. And who knows, maybe someone else will step up and tackle it? Let's see ...

  • 🇷🇴Romania bbu23

    So I'm trying to avoid having opened issues whenever I can. This means, that I am trying to take a decision whether to go forward with this or cancel it.

    I created a kinda POC with how this replacement would behave/look like with the mention that the proposed "Export menus" and "Import menus" menu items are implemented as "Menu exports" and "Menu imports". The reason is simple: Menu exports is the plural of Menu export and those pages are listings of Menu export or Menu import entities.

    On the other hand, I had/have some inner conflicts with this. I admit that it looks & sounds better for sure, but going back to the source issue, I'm just curious why "Content Type" is fine but not "Export Type". After all, this is a type of export and "Article" is a type of content.

    Furthermore, if I decide to advance with this, from now on there will be a distinction between UI text and code text, which by itself is not a problem, but let's call it "a very small bifurcation".

    Will be playing with it, thinking, but looking forward to your response @ressa

  • 🇩🇰Denmark ressa Copenhagen

    Thanks @bbu23 for creating an implementation of the proposed solution so fast!

    It looks great, and it feels more intuitive now. (There was a single detail, I added a comment in my review.)

    I think the reason the "Export type" thing caused me a slight confusion, is because this module is strictly about menus, and as a user, I just don't expect to wrangle with a new concept of "Types". Also "Type" doesn't give any meaning to me.

    Thinking more about it, the individual items (types/exports) could get a more specific name, more special than "Menu exports" ... "Menu group" could work, to signify that this is a collection of menus? Or even "Menu collection"? Or maybe it again just could be a cause of confusion, introducing new concepts ...

    So all in all, I am a fan of the current POC :)

  • 🇷🇴Romania bbu23

    Thank you for your answer on the "Type" thing, seems fair enough.

    As for "Menu group", "Menu collection" etc. I'll stick to the initial proposal, as at the moment I consider a must to have the "export" and "import" words present, agreeing with your last statement:

    Or maybe it again just could be a cause of confusion, introducing new concepts ...

    Thanks for your feedback as well!

    • bbu23 committed a27e0bc5 on 4.0.x
      Issue #3486358: Remove and replace the use of the word "type" in the UI
      
  • 🇩🇰Denmark ressa Copenhagen

    Perfect, thanks for the great work!

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

Production build 0.71.5 2024