Skip to content

Commit

Permalink
Only use the E+ controller if that module is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
argiepiano committed Oct 5, 2022
1 parent 9d5a620 commit 81f3f36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion profile.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ description = Supports configurable user profiles.
backdrop = 1.x
configure = admin/structure/profiles
type = module
dependencies[] = entity_plus
13 changes: 12 additions & 1 deletion profile.module
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function profile_entity_info() {
'label' => t('Profile'),
'description' => t('Profile user profiles.'),
'entity class' => 'Profile',
'controller class' => 'EntityPlusController',
'controller class' => 'EntityDatabaseStorageController',
'base table' => 'profile',
'fieldable' => TRUE,
'view modes' => array(
Expand All @@ -61,6 +61,7 @@ function profile_entity_info() {
'access callback' => 'profile_access',
'module' => 'profile',
'metadata controller class' => 'ProfileMetadataController',
'token type' => 'profile',
),
);

Expand All @@ -81,6 +82,16 @@ function profile_entity_info() {
return $return;
}

/**
* Implements hook_entity_info_alter().
*/
function profile_entity_info_alter(&$entity_info) {
// Switch to the controller provided by Entity Plus if available.
if (module_exists('entity_plus')) {
$entity_info['profile']['controller class'] = 'EntityPlusController';
}
}

/**
* Menu argument loader; Load a profile type by string.
*
Expand Down

0 comments on commit 81f3f36

Please sign in to comment.