Skip to content

Instantly share code, notes, and snippets.

@Modicrumb
Created July 24, 2013 19:39
Show Gist options
  • Save Modicrumb/6073795 to your computer and use it in GitHub Desktop.
Save Modicrumb/6073795 to your computer and use it in GitHub Desktop.
My first drupal module
<?php
/* This module creates a custom block which users are not allowed to be able to alter*/
/**
* Implements hook_help.
*
* Displays help and module information.
*
* @param path
* Which path of the site we're using to display help
* @param arg
* Array that holds the current path as returned from arg() function
*/
function custom_copyright_help($path, $arg) {
switch ($path) {
case "admin/help#current_posts":
return '<p>' . t("Displays Custom Copyright Text") . '</p>';
break;
}
}
/**
* Implements hook_block_info().
*/
function custom_copyright_block_info() {
$blocks['custom_copyright'] = array(
'info' => t('Custom Copyright'), //The name that will appear in the block list.
'cache' => DRUPAL_CACHE_PER_ROLE, //Default
);
return $blocks;
}
/**
* Implements hook_block_view().
* This is where we define the content of the block as well as its title
*/
function custom_copyright_block_view($delta = 'custom_copyright') {
$block = array();
$block['subject'] = '';
$block['content'] = 'example content here' ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment