diff --git a/permalink_block.install b/permalink_block.install index f54b942..6cda67b 100644 --- a/permalink_block.install +++ b/permalink_block.install @@ -8,11 +8,79 @@ * Implements hook_install(). */ function permalink_block_install() { + // Create a first sample page. $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 > Configure'), 'admin/structure/block/manage/permalink_block/permalink/configure'), - ) + + $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 toggle the popup functionality off/on, disable/enable 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 Popup module.

A patch provides some sample content and settings to deploy it 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-10.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 +/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 > Configure'), 'admin/structure/block/manage/permalink_block/permalink/configure'), + ) + ); drupal_set_message($text); } @@ -24,4 +92,20 @@ function permalink_block_uninstall() { variable_del('permalink_block_suppress_copybox'); variable_del('permalink_block_popup_width'); variable_del('permalink_block_show'); + // Remove the admin quick links. + $path = 'admin/structure/block/manage/permalink_block/permalink +/configure'; + menu_link_delete(NULL, $path); + $path = 'admin/config/user-interface/popup'; + menu_link_delete(NULL, $path); + + // 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); }