Skip to content

Instantly share code, notes, and snippets.

@neotohin-snippet
Created April 26, 2013 15:39
Show Gist options
  • Save neotohin-snippet/5468202 to your computer and use it in GitHub Desktop.
Save neotohin-snippet/5468202 to your computer and use it in GitHub Desktop.
drupal:oop_module
<?php
define('DOCROOT', dirname(__FILE__));
spl_autoload_register('st_oop_autoload');
/**
* Autoload Mechanism
*/
function st_oop_autoload( $class )
{
$path = DOCROOT . '/includes/' . $class . '.class.inc';
$path = str_replace("\\", "/", $path);
if(file_exists($path))
{
require_once($path);
}
return;
}
/**
* Implements hook_block_info().
*/
function st_oop_block_info() {
$blocks['block_1'] = array (
'info' => Text::getInfo(),
);
return $blocks;
}
/**
* Implements hook_block_view().
*/
function st_oop_block_view($delta = '') {
$block = array();
switch ($delta) {
case 'block_1':
$block['subject'] = Text::getSubject();
$block['content'] = Body::getContent();
break;
}
return $block;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment