Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have define the following in my module, as per the documentation. How ever the post install callback is never called -> sac_chapter_affiliation_app_post_install.
/**
* Implements hook_apps_app_info().
*/
function sac_chapter_affiliation_apps_app_info() {
return array('post install callback' => 'sac_chapter_affiliation_app_post_install');
}
/**
* Helper function to run post app installation configuration.
*/
function sac_chapter_affiliation_app_post_install() {
dsm('sac_chapter_affiliation_app_post_install');
// We do this here and not in the install hook as when the install hook runs
// the vocabulary sac_affiliation_types does not yet exist.
$vocabulary_name = 'sac_affiliation_types';
$vocabulary = taxonomy_vocabulary_machine_name_load($vocabulary_name);
// Add default vocabulary term
$term = new stdClass();
$term->name = 'individual affiliations';
$term->vid = $vocabulary->vid;
$term->vocabulary_machine_name = $vocabulary->machine_name;
$term->parent = array(0);
taxonomy_term_save($term);
// Add default vocabulary term
$term = new stdClass();
$term->name = 'corporate affiliations';
$term->vid = $vocabulary->vid;
$term->vocabulary_machine_name = $vocabulary->machine_name;
$term->parent = array(0);
taxonomy_term_save($term);
}
Comment | File | Size | Author |
---|---|---|---|
#8 | apps-post-enabled-disabled-callback-1990512-8.patch | 2.58 KB | mrfelton |
#7 | fix-callback-1990512-7.patch | 3.22 KB | lathan |
#6 | fix-callback-1990512-6.patch | 1.83 KB | lathan |
#5 | fix-callback-1990512-5.patch | 1.99 KB | lathan |
#3 | fix-callback-1990512-3.patch | 1.02 KB | lathan |
Comments
Comment #1
lathanupdate title better description.
Comment #2
lathanHere is a patch, not the callback on the disable was missing.
according to the API this should be called there as well. 'post install callback' => 'appname_app_post_install', // This will be called after the app is enabled intialy or of the app has been uninstalled
Comment #3
lathanComment #4
lathanthe call to the 'post install callback' is firing for the disable function however the enable it is still not i have looked up and found that the clear cache all usage before these callbacks are called should also change to use the system_rebuild_module_data() function.
Comment #5
lathanRight this now correctly gets the callback firing on module enable / disable.
Comment #6
lathanHad the callback firing on the wrong hook, according to the api wording, also fixed white space. "// This will be called after the app is enabled intialy or of the app has been uninstalled"
Comment #7
lathanWe needed more hooks on the app enable / disable / uninstall process.
I have gone a head and added two new ones and documented them in the API as well.
Comment #8
mrfelton CreditAttribution: mrfelton commentedPatch slightly updated for latest apps version.
Comment #9
hefox CreditAttribution: hefox commented+ // Else try load this module (happens when module is not enabled)
+ if (isset($app['machine_name']) && !empty($key)) {
+ module_load_include("module", $app['machine_name']);
+ $info = module_invoke($app['machine_name'], 'apps_app_info');
+ if (isset($info[$key]) && function_exists($info[$key])) {
+ return $info[$key];
+ }
+ }
(dreditor not working for me atm!)
So, I can't reproduce needing to recall apps_app_info -- the way it gets the info works fine for disabled apps.
Comment #10
hefox CreditAttribution: hefox commentedComment #11
amuhebwa CreditAttribution: amuhebwa commentedI hadn't seen this issue, i shouldn't have replicated it. but here is the link with a patch https://www.drupal.org/node/2376519#comment-9370591
Comment #12
berdyshev CreditAttribution: berdyshev at AMgrade commented@hefox, @mrfelton, The app info is not loaded during distribution installation process because drupal is not fully bootstrapped. But, I think instead of this invocation of
hook_apps_app_info()
inapps_app_callback()
it is better to do this when it should be done inapps_add_app_info()
. See the issue #2753413: app_manifest() could not call hook_apps_app_info()