summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/comment/helpers/comment_block.php2
-rw-r--r--modules/gallery/controllers/admin_dashboard.php4
-rw-r--r--modules/gallery/helpers/block_manager.php14
-rw-r--r--modules/gallery/helpers/gallery_block.php5
4 files changed, 17 insertions, 8 deletions
diff --git a/modules/comment/helpers/comment_block.php b/modules/comment/helpers/comment_block.php
index 08182905..b989be6b 100644
--- a/modules/comment/helpers/comment_block.php
+++ b/modules/comment/helpers/comment_block.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class comment_block_Core {
- static function get_list() {
+ static function get_admin_list() {
return array("recent_comments" => t("Recent Comments"));
}
diff --git a/modules/gallery/controllers/admin_dashboard.php b/modules/gallery/controllers/admin_dashboard.php
index 3cb97b14..6bf3b966 100644
--- a/modules/gallery/controllers/admin_dashboard.php
+++ b/modules/gallery/controllers/admin_dashboard.php
@@ -34,7 +34,7 @@ class Admin_Dashboard_Controller extends Admin_Controller {
$form = gallery_block::get_add_block_form();
if ($form->validate()) {
list ($module_name, $id) = explode(":", $form->add_block->id->value);
- $available = block_manager::get_available();
+ $available = block_manager::get_available_admin_blocks();
if ($form->add_block->center->value) {
block_manager::add("dashboard_center", $module_name, $id);
@@ -66,7 +66,7 @@ class Admin_Dashboard_Controller extends Admin_Controller {
}
if (!empty($deleted)) {
- $available = block_manager::get_available();
+ $available = block_manager::get_available_admin_blocks();
$title = $available[join(":", $deleted)];
message::success(t("Removed <b>%title</b> block", array("title" => $title)));
}
diff --git a/modules/gallery/helpers/block_manager.php b/modules/gallery/helpers/block_manager.php
index 20b641d4..c5320922 100644
--- a/modules/gallery/helpers/block_manager.php
+++ b/modules/gallery/helpers/block_manager.php
@@ -38,13 +38,21 @@ class block_manager_Core {
self::set_active($location, $blocks);
}
- static function get_available() {
+ static function get_available_admin_blocks() {
+ return self::_get_blocks("get_admin_list");
+ }
+
+ static function get_available_site_blocks() {
+ return self::_get_blocks("get_site_list");
+ }
+
+ private static function _get_blocks($function) {
$blocks = array();
foreach (module::active() as $module) {
$class_name = "{$module->name}_block";
- if (method_exists($class_name, "get_list")) {
- foreach (call_user_func(array($class_name, "get_list")) as $id => $title) {
+ if (method_exists($class_name, $function)) {
+ foreach (call_user_func(array($class_name, $function)) as $id => $title) {
$blocks["{$module->name}:$id"] = $title;
}
}
diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php
index b7816954..f2cb8ded 100644
--- a/modules/gallery/helpers/gallery_block.php
+++ b/modules/gallery/helpers/gallery_block.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class gallery_block_Core {
- static function get_list() {
+ static function get_admin_list() {
return array(
"welcome" => t("Welcome to Gallery 3!"),
"photo_stream" => t("Photo Stream"),
@@ -94,7 +94,8 @@ class gallery_block_Core {
$form = new Forge("admin/dashboard/add_block", "", "post",
array("id" => "gAddDashboardBlockForm"));
$group = $form->group("add_block")->label(t("Add Block"));
- $group->dropdown("id")->label(t("Available Blocks"))->options(block_manager::get_available());
+ $group->dropdown("id")->label(t("Available Blocks"))
+ ->options(block_manager::get_available_admin_blocks());
$group->submit("center")->value(t("Add to center"));
$group->submit("sidebar")->value(t("Add to sidebar"));
return $form;