diff --git a/permalink_block.install b/permalink_block.install index 6630597..8badb63 100644 --- a/permalink_block.install +++ b/permalink_block.install @@ -8,10 +8,100 @@ * Implements hook_install(). */ function permalink_block_install() { + // Create a first sample page. $t = get_t(); - $text = $t('Congrats! All non-admin pages now contain a permalink. Change the settings at !config_link.', array( + + $node = new stdClass(); + $node->uid = 1; + $node->language = 'und'; + $node->type = 'page'; + $node->status = 1; + $node->promote = 1; + $node->title = $t('Where to customize the Permalink'); + $node->body['und'][0]['value'] = $t('

Despite the absence of a settings page for the Permalink module, display can be customized through block settings, a CSS file and template file.

To position the Permalink on the page and exclude it from some pages use the block settings. You will not find any other settings in the UI. To customize the output, edit the module CSS (permalink_block.css) and template file (permalink_block.tpl.php). Just follow the instructions in the code comments.

Below you see how the Permalink Block displays. To disactivate the popup functionality, disable the popup module.

'); + $node->body['und'][0]['format'] = 'full_html'; + $node->menu = array ( + 'enabled' => 1, + 'mlid' => 0, + 'module' => 'menu', + 'hidden' => 0, + 'has_children' => 0, + 'customized' => 0, + 'options' => + array ( + ), + 'expanded' => 0, + 'parent_depth_limit' => 8, + 'link_title' => $t('Sample page'), + 'description' => '', + 'parent' => 'main-menu:0', + 'weight' => '1', + 'plid' => '0', + 'menu_name' => 'main-menu', + ); + node_save($node); + + // Create a second sample page. + $t = get_t(); + + $node = new stdClass(); + $node->uid = 1; + $node->language = 'und'; + $node->type = 'page'; + $node->status = 1; + $node->promote = 1; + $node->title = $t('Demo site'); + $node->body['und'][0]['value'] = $t('

This is the demo site for the Permalink Block module.

It also contains the Popupmodule.

A patch that provides some sample content and settings is used to deploy is as a demo on simplytest.me. For more info, read issue https://drupal.org/node/2043135.

The activation link of the demo is:
http://simplytest.me/project/permalink_block/7.x-1.x?add[]=popup&patch[]=https://drupal.org/files/demo-2043135-4.patch.

'); + $node->body['und'][0]['format'] = 'full_html'; + node_save($node); + + // Enable the popup module. + module_enable(array('popup'), 'FALSE'); + + // Create some admin quick links in the navigation menu. + $item = array( + 'link_title' => st('Configure Permalink Block'), + 'link_path' => 'admin/structure/block/manage/permalink_block/permalink_copybox/configure', + ); + menu_link_save($item); + $item = array( + 'link_title' => st('Popup settings'), + 'link_path' => 'admin/config/user-interface/popup', + ); + menu_link_save($item); + + // Set the site slogan. + variable_set('site_slogan', 'Demo of the Permalink Block module'); + + // Display a message if installation was successful. + $t = get_t(); + $text = $t('All non-admin pages now contain a Permalink. Change the settings at !config_link.', array( '!config_link' => l($t('Structure > Blocks > Permalink copy box > Configure'), 'admin/structure/block/manage/permalink_block/permalink_copybox/configure'), ) ); drupal_set_message($text); } + +/** + * Implements hook_uninstall(). + */ +function permalink_block_uninstall() { + // Remove the admin quick links. + $path = 'admin/structure/block/manage/permalink_block/permalink_copybox/configure'; + menu_link_delete(NULL, $path); + $path = 'admin/config/user-interface/popup'; + menu_link_delete(NULL, $path); + + // Disable and uninstall the popup module. + module_disable(array('popup'), 'FALSE'); + + // Clear the site slogan. + variable_set('site_slogan', ''); + // Remove the sample node. + $nid='1'; // $node id , which you want to delete; + node_delete($nid); + + $nid='2'; // $node id , which you want to delete; + node_delete($nid); + } +