Created
September 13, 2012 18:04
-
-
Save baisong/3716276 to your computer and use it in GitHub Desktop.
What is wrong with this boxes implementation?
This file contains hidden or 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
| // From os_biocv.module | |
| /** | |
| * Implements hook_os_widget(). | |
| * | |
| * Exposes blocks as OpenScholar widgets. | |
| */ | |
| function os_biocv_os_widget() { | |
| $items = array(); | |
| // Displays user's Bio node if available, otherwise prompts user. | |
| $items['os_biocv-bio'] = array( | |
| 'module' => 'boxes', | |
| 'delta' => 'boxes-bio', | |
| 'weight' => '-10', | |
| 'info' => 'Bio Teaser', | |
| ); | |
| return $items; | |
| } | |
| // From os_biocv.info | |
| features[box][] = boxes-bio | |
| // From os_biocv.box.inc | |
| /** | |
| * Implements hook_default_box(). | |
| */ | |
| function os_biocv_default_box() { | |
| $export = array(); | |
| $nid = 0; | |
| if (function_exists('_os_biocv_get_bio_node')) { | |
| $node = _os_biocv_get_bio_node(); | |
| if ($node !== FALSE) { | |
| $nid = $node->nid; | |
| } | |
| } | |
| $box = new stdClass(); | |
| $box->disabled = FALSE; /* Edit this to true to make a default box disabled initially */ | |
| $box->api_version = 1; | |
| $box->delta = 'bio'; | |
| $box->plugin_key = 'os_boxes_bio'; | |
| $box->title = ''; | |
| $box->description = 'Bio Teaser'; | |
| $box->options = array( | |
| 'nid' => $nid, | |
| 'teaser' => 'teaser', | |
| ); | |
| $export['boxes-bio'] = $box; | |
| return $export; | |
| } | |
| // From os_bioxes_bio.inc | |
| class os_boxes_bio extends os_boxes_default { | |
| /** | |
| * Implements boxes_content::options_defaults(). | |
| */ | |
| public function options_defaults() { | |
| // ... | |
| return array(); | |
| } | |
| /** | |
| * Implements boxes_content::options_form(). | |
| */ | |
| public function options_form(&$form_state) { | |
| // ... | |
| return $form; | |
| } | |
| /** | |
| * Implements boxes_content::render(). | |
| */ | |
| public function render() { | |
| // ... | |
| return array(); | |
| } | |
| /** | |
| * Renders empty text for a vsite admin without a Bio node | |
| */ | |
| protected function render_no_bio() { | |
| // ... | |
| return $string; | |
| } | |
| /** | |
| * Returns the cache parameters for this box | |
| */ | |
| public function cache_info() { | |
| // ... | |
| return array(); | |
| } | |
| } | |
| // From os_boxes.plugins.inc | |
| function _os_boxes_boxes_plugins() { | |
| // ... | |
| $info['os_boxes_bio'] = array( | |
| 'title' => 'Bio', | |
| 'description' => 'Teaser of your personal Bio', | |
| 'tags' => array('Social'), | |
| 'handler' => array( | |
| 'class' => 'os_boxes_bio', | |
| 'file' => 'os_boxes_bio.inc', | |
| 'path' => $path . '/os_boxes_bio', | |
| 'parent' => 'os_boxes_default', | |
| ), | |
| ); | |
| // ... | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, with the code above, the widget displays on the CP Layout page, but:
*This makes it hard to test the box content -- I can't get it to display!