Hi, project maintainers!

Problem/Motivation

This module does not add a reference to a "clone" local task for entities of a product type from the commerce module that has cloning enabled.

Steps to reproduce

I have enabled cloning of product type objects from the commerce module on the /admin/config/content_entity_clone page and configured the required fields to fill in, but the /product/add/default?content_entity_clone= link is not displayed on the local product tab.

Other entities, such as the node page, are fine.

Command icon Show commands

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

profwebsait created an issue. See original summary.

jmee’s picture

I'm having the same issue (Drupal 9.5.9, PHP8.1, content_entity_clone 1.0.2)

After enabling and configuring cloning for a Product bundle, there aren't any changes to the UI (no clone tab while viewing a single product, no clone task for the operations in the drop button while looking at the product overview).

If I manually construct the link, like https://example.com/product/add/default?content_entity_clone=12345, everything works perfectly as expected, so that's great! We're just missing a way for content editors to get there.

jmee’s picture

As far as I can tell, this is likely an issue with the way that Commerce builds the route - I notice that there's an attempt to build the link to the entity creation page in content_entity_clone.module, which notes that there is no consistent way that this is done.

In Commerce, I think that there is an 'add-form' link defined in Drupal\commerce_product\Entity (in the product submodule), not sure if there's a straight foward way to account for commerce products here.

Here's my 10 minute workaround - add a link in a block using a view with a contextual filter :

langcode: en
status: true
dependencies:
  module:
    - commerce
    - commerce_product
    - user
id: product_clone_button
label: 'Product Clone Button'
module: views
description: 'This view is a workaround for https://www.drupal.org/project/content_entity_clone/issues/3344584'
tag: ''
base_table: commerce_product_field_data
base_field: product_id
display:
  default:
    id: default
    display_title: Default
    display_plugin: default
    position: 0
    display_options:
      title: 'Product Clone Button'
      fields:
        title:
          id: title
          table: commerce_product_field_data
          field: title
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: null
          entity_field: title
          plugin_id: field
          label: ''
          exclude: true
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: string
          settings:
            link_to_entity: false
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
        type:
          id: type
          table: commerce_product_field_data
          field: type
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: commerce_product
          entity_field: type
          plugin_id: commerce_entity_bundle
          label: ''
          exclude: true
          alter:
            alter_text: true
            text: '{{ type__target_id }}'
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: true
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: target_id
          type: entity_reference_label
          settings:
            link: false
          group_column: target_id
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
          hide_single_bundle: false
        product_id:
          id: product_id
          table: commerce_product_field_data
          field: product_id
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: commerce_product
          entity_field: product_id
          plugin_id: field
          label: ''
          exclude: false
          alter:
            alter_text: true
            text: '<a href="/product/add/{{ type }}?content_entity_clone={{ product_id }}" class="btn btn-primary">Clone</a>'
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: number_integer
          settings:
            thousand_separator: ''
            prefix_suffix: false
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
      pager:
        type: none
        options:
          offset: 0
          items_per_page: 0
      exposed_form:
        type: basic
        options:
          submit_button: Apply
          reset_button: false
          reset_button_label: Reset
          exposed_sorts_label: 'Sort by'
          expose_sort_order: true
          sort_asc_label: Asc
          sort_desc_label: Desc
      access:
        type: perm
        options:
          perm: 'clone content entities'
      cache:
        type: tag
        options: {  }
      empty: {  }
      sorts: {  }
      arguments:
        product_id:
          id: product_id
          table: commerce_product_field_data
          field: product_id
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: commerce_product
          entity_field: product_id
          plugin_id: numeric
          default_action: default
          exception:
            value: all
            title_enable: false
            title: All
          title_enable: false
          title: ''
          default_argument_type: product
          default_argument_options: {  }
          default_argument_skip_url: false
          summary_options:
            base_path: ''
            count: true
            override: false
            items_per_page: 25
          summary:
            sort_order: asc
            number_of_records: 0
            format: default_summary
          specify_validation: false
          validate:
            type: none
            fail: 'not found'
          validate_options: {  }
          break_phrase: false
          not: false
      filters:
        status:
          id: status
          table: commerce_product_field_data
          field: status
          entity_type: commerce_product
          entity_field: status
          plugin_id: boolean
          value: '1'
          group: 1
          expose:
            operator: ''
            operator_limit_selection: false
            operator_list: {  }
      style:
        type: default
      row:
        type: fields
      query:
        type: views_query
        options:
          query_comment: ''
          disable_sql_rewrite: false
          distinct: false
          replica: false
          query_tags: {  }
      relationships: {  }
      header: {  }
      footer: {  }
      display_extenders: {  }
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - url
        - user.permissions
      tags: {  }
  block_1:
    id: block_1
    display_title: Block
    display_plugin: block
    position: 1
    display_options:
      display_extenders: {  }
      block_hide_empty: true
      allow:
        items_per_page: false
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - url
        - user.permissions
      tags: {  }
matthieu_collet’s picture

HI

Is there any news for this issue ? we have the same problem

thank you

c_archer’s picture

Has any progress been made with this?

guiu.rocafort.ferrer made their first commit to this issue’s fork.

guiu.rocafort.ferrer’s picture

Status: Active » Needs review

orakili made their first commit to this issue’s fork.

orakili’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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