Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom CiviCRM entity type ID #501

Open
wants to merge 1 commit into
base: 4.0.x
Choose a base branch
from

Conversation

puresyntax71
Copy link
Contributor

Overview

If a table name for a CiviCRM entity is longer than 32, Drupal throws this error:

Attempt to create an entity type with an ID longer than 32 characters: civicrm_inventory_product_membership.

The changes here allows having a CiviCRM entity type ID different from the base table. This is an example:

/**
 * Implements hook_civicrm_alter_drupal_entities().
 */
function civicrm_tweaks_civicrm_alter_drupal_entities(&$info) {
  $info['civicrm_i_product_membership'] = [
    'civicrm entity label' => t('Product membership'),
    'civicrm entity name' => 'inventory_product_membership',
    'label property' => 'id',
    'base table' => 'civicrm_inventory_product_membership',
    'permissions' => [
      'view' => [],
      'update' => [],
      'create' => [],
      'delete' => [],
    ],
  ];
}

Before

Drupal throws error if CiviCRM entity name is longer than 32 characters.

After

No more errors.

@civibot civibot bot added the 4.0.x label Sep 9, 2024
@puresyntax71 puresyntax71 changed the title Test. Allow custom CiviCRM entity type ID Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant