Created
April 26, 2013 15:39
-
-
Save neotohin-snippet/5468202 to your computer and use it in GitHub Desktop.
drupal:oop_module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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