0

We have a mini panel that we use to create a footer area. This is deployed on install of a new multi-site through our custom installation profile. I would like to set default content items in the panel regions on install. If I were to do this in a feature, then any changes made by the site administrator would be reverted on a features-revert-all command. How do I go about creating this as part of an install file?

1
  • This is for Drupal 7.
    – shelane
    Commented Sep 14, 2016 at 15:18

1 Answer 1

0

To start, I created my mini panel as I wanted it to be and did an export. I saved the export code to a file in a custom module I created. I used install file in the module and this hook_install function:

function custom_footer_install() {
  if (!ctools_export_crud_load('panels_mini', 'fat_footer')) {
    $filename = drupal_get_path('module', 'custom_footer') . '/panel_exports/profile.txt';
    $handle = fopen($filename, "r");
    $contents = fread($handle, filesize($filename));
    fclose($handle);
    $panel = ctools_export_crud_import('panels_mini', $contents);
    ctools_export_crud_save('panels_mini', $panel);
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.