summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Zgadzaj2016-05-22 13:42:47 -0400
committerMaciej Zgadzaj2016-05-22 13:42:47 -0400
commitc9a6bdc41eccf966680872bcee73a1b08510b186 (patch)
tree9acd14ca82031304a45e48bf5598b456d26d3da6
parentc293e69ec9d4c1eabef387d25d1f0b6eaed58c4f (diff)
Issue #2705755: Conflict with file_entity by using hook_path_alias_types
-rw-r--r--pathauto_entity.module16
1 files changed, 15 insertions, 1 deletions
diff --git a/pathauto_entity.module b/pathauto_entity.module
index f624ea7..3cfd00e 100644
--- a/pathauto_entity.module
+++ b/pathauto_entity.module
@@ -33,6 +33,20 @@ function pathauto_entity_menu_alter(&$items) {
}
/**
+ * Implements hook_module_implements_alter().
+ */
+function pathauto_entity_module_implements_alter(&$implementations, $hook) {
+ // Both this module and file_entity implement hook_path_alias_types() and
+ // provide an object for 'file' entity type, which then generates nested array
+ // in module_invoke_all(), which uses array_merge_recursive(). To avoid this,
+ // let's keep only implementation from this module (as it is more generic),
+ // and get rid of file_entity module implementation.
+ if ($hook == 'path_alias_types' && isset($implementations['file_entity'])) {
+ unset($implementations['file_entity']);
+ }
+}
+
+/**
* Implements hook_path_alias_types().
*
* Provides additional URL alias types for deletion.
@@ -56,7 +70,7 @@ function pathauto_entity_path_alias_types() {
// Commerce entities, where 'commerce_product' entity types have URIs
// like /admin/commerce/products/<product_id>).
$entity_info = entity_get_info($entity_type);
- $objects[$entity_type . '/'] = t($entity_info['label']);
+ $objects[$entity_type . '/'] = !empty($entity_info['plural label']) ? t($entity_info['plural label']) : t($entity_info['label']);
// For those entity types with different URIs, we might also want to
// expose their bundles to the deletion form, and also try to generate