aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-07-06 06:51:53 -0400
committerCash Costello <cash.costello@gmail.com>2011-07-06 06:51:53 -0400
commitd15c4bdf3388b7eca709bd81c522ac1ebf087f0a (patch)
treef8d7ce9e0e8a36be07041fef133d964628ff2d01 /engine
parent9b042da78566d284d71ca5299d9f9402c49d36ba (diff)
downloadelgg-d15c4bdf3388b7eca709bd81c522ac1ebf087f0a.tar.gz
elgg-d15c4bdf3388b7eca709bd81c522ac1ebf087f0a.tar.bz2
changed new convenience function from elgg_register_add_button() to elgg_register_title_button()
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/navigation.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php
index cdf3d0f67..1305ee3de 100644
--- a/engine/lib/navigation.php
+++ b/engine/lib/navigation.php
@@ -154,17 +154,20 @@ function elgg_is_menu_item_registered($menu_name, $item_name) {
}
/**
- * Convenience function for registering an add content button to title menu
+ * Convenience function for registering a button to title menu
*
- * The add URL must be $handler/add/$guid where $guid is the guid of the page owner.
- * The label of the button is "$handler:add" so that must be defined in a
+ * The URL must be $handler/$name/$guid where $guid is the guid of the page owner.
+ * The label of the button is "$handler:$name" so that must be defined in a
* language file.
*
+ * This is used primarily to support adding an add content button
+ *
* @param string $handler The handler to use or null to autodetect from context
+ * @param string $name Name of the button
* @return void
* @since 1.8.0
*/
-function elgg_register_add_button($handler = null) {
+function elgg_register_title_button($handler = null, $name = 'add') {
if (elgg_is_logged_in()) {
if (!$handler) {
@@ -179,9 +182,9 @@ function elgg_register_add_button($handler = null) {
if ($owner && $owner->canWriteToContainer()) {
$guid = $owner->getGUID();
elgg_register_menu_item('title', array(
- 'name' => 'add',
- 'href' => "$handler/add/$guid",
- 'text' => elgg_echo("$handler:add"),
+ 'name' => $name,
+ 'href' => "$handler/$name/$guid",
+ 'text' => elgg_echo("$handler:$name"),
'link_class' => 'elgg-button elgg-button-action',
));
}