Skip to content

Commit

Permalink
Moved profile create into features from hook_enable()
Browse files Browse the repository at this point in the history
  • Loading branch information
cableman committed Jun 3, 2013
1 parent 7dee5d0 commit a6c005a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
2 changes: 1 addition & 1 deletion alma.features.field_base.inc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function alma_field_default_field_bases() {
60 => '2 months',
90 => '3 months',
180 => '6 months',
360 => '12 months'
360 => '12 months',
),
'allowed_values_function' => '',
'profile2_private' => 0,
Expand Down
21 changes: 21 additions & 0 deletions alma.features.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* @file
* alma.features.inc
*/

/**
* Implements hook_default_profile2_type().
*/
function alma_default_profile2_type() {
$items = array();
$items['provider_alma'] = entity_import('profile2_type', '{
"userCategory" : true,
"userView" : true,
"type" : "provider_alma",
"label" : "Profile for Alma",
"weight" : "0",
"data" : { "registration" : 0 }
}');
return $items;
}
4 changes: 3 additions & 1 deletion alma.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ description = Implementation of Axiell’s Alma API for DDELibra.
core = 7.x
package = Providers
php = 5.2.4
version = 7.x-1.0-beta1
version = 7.x-1.0-beta2
project = alma
dependencies[] = date
dependencies[] = ding_provider
dependencies[] = ding_reservation
dependencies[] = email
dependencies[] = entity
dependencies[] = features
dependencies[] = list
dependencies[] = options
Expand Down Expand Up @@ -38,6 +39,7 @@ features[field_instance][] = profile2-provider_alma-field_alma_postal_code
features[field_instance][] = profile2-provider_alma-field_alma_preferred_branch
features[field_instance][] = profile2-provider_alma-field_alma_reservation_pause
features[field_instance][] = profile2-provider_alma-field_alma_street_name
features[profile2_type][] = provider_alma
files[] = alma.module
files[] = includes/alma.availability.inc
files[] = includes/alma.debt.inc
Expand Down
17 changes: 0 additions & 17 deletions alma.install
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
<?php


/**
* Implements hook_enable().
*
* Adds a profile2 type to use as this providers user profile.
*/
function alma_enable() {
$profile_type = new ProfileType(
array(
'type' => 'provider_alma',
'label' => t('Profile for Alma'),
'userCategory' => TRUE,
'userView' => TRUE,
)
);
$profile_type->save();
}

/**
* Update system table set alma weight=10 to ensure form_alter hooks are called
* AFTER ding_user and ding_provider
Expand Down
8 changes: 5 additions & 3 deletions alma.module
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/**
* @file
*
* Code for the Alma feature.
*/

define('ALMA_AUTH_BLOCKED', '4e5531951f55ab8f6895684999c69c2');
Expand Down Expand Up @@ -612,4 +611,7 @@ function alma_profile2_load($entities) {
$wrapper->field_alma_mail->set($patron->email);
}
}
}
}

// Include the feature code.
include_once 'alma.features.inc';

0 comments on commit a6c005a

Please sign in to comment.