aboutsummaryrefslogtreecommitdiff
path: root/views/default
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-05-20 02:08:21 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-05-20 02:08:21 +0000
commit9850f323a5fe899814201b0354712644f8e80092 (patch)
tree38b9f99e480b8a1eb8f5352953c7269fce0c92e1 /views/default
parent6edf852e9c5e352e02140ba9f2ab93b3a8750172 (diff)
downloadelgg-9850f323a5fe899814201b0354712644f8e80092.tar.gz
elgg-9850f323a5fe899814201b0354712644f8e80092.tar.bz2
Fixes #3189 adds entity support to tags and access views
git-svn-id: http://code.elgg.org/elgg/trunk@9106 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default')
-rw-r--r--views/default/input/access.php11
-rw-r--r--views/default/input/tags.php11
-rw-r--r--views/default/output/tags.php18
3 files changed, 28 insertions, 12 deletions
diff --git a/views/default/input/access.php b/views/default/input/access.php
index 7fa2323bf..40a93aaa4 100644
--- a/views/default/input/access.php
+++ b/views/default/input/access.php
@@ -3,12 +3,10 @@
* Elgg access level input
* Displays a dropdown input field
*
- * @package Elgg
- * @subpackage Core
- *
* @uses $vars['value'] The current value, if any
* @uses $vars['options_values']
* @uses $vars['name'] The name of the input field
+ * @uses $vars['entity'] Optional. The entity for this access control (uses access_id)
*/
$defaults = array(
@@ -18,6 +16,11 @@ $defaults = array(
'options_values' => get_write_access_array(),
);
+if (isset($vars['entity'])) {
+ $defaults['value'] = $vars['entity']->access_id;
+ unset($vars['entity']);
+}
+
$vars = array_merge($defaults, $vars);
if ($vars['value'] == ACCESS_DEFAULT) {
@@ -26,4 +29,4 @@ if ($vars['value'] == ACCESS_DEFAULT) {
if (is_array($vars['options_values']) && sizeof($vars['options_values']) > 0) {
echo elgg_view('input/dropdown', $vars);
-} \ No newline at end of file
+}
diff --git a/views/default/input/tags.php b/views/default/input/tags.php
index 539bbd4db..7cda958aa 100644
--- a/views/default/input/tags.php
+++ b/views/default/input/tags.php
@@ -3,8 +3,10 @@
* Elgg tag input
* Displays a tag input field
*
- * @package Elgg
- * @subpackage Core
+ * @uses $vars['disabled']
+ * @uses $vars['class']
+ * @uses $vars['value'] Array of tags or a string
+ * @uses $vars['entity'] Optional. Entity whose tags are being displayed (metadata ->tags)
*/
$defaults = array(
@@ -12,6 +14,11 @@ $defaults = array(
'disabled' => FALSE,
);
+if (isset($vars['entity'])) {
+ $defaults['value'] = $vars['entity']->tags;
+ unset($vars['entity']);
+}
+
$vars = array_merge($defaults, $vars);
if (is_array($vars['value'])) {
diff --git a/views/default/output/tags.php b/views/default/output/tags.php
index 345b256c4..57cb21ea7 100644
--- a/views/default/output/tags.php
+++ b/views/default/output/tags.php
@@ -1,17 +1,19 @@
<?php
/**
* Elgg tags
- *
* Tags can be a single string (for one tag) or an array of strings
*
- * @package Elgg
- * @subpackage Core
- *
- * @uses $vars['tags'] The tags to display
- * @uses $vars['type'] The entity type, optional
+ * @uses $vars['value'] Array of tags or a string
+ * @uses $vars['type'] The entity type, optional
* @uses $vars['subtype'] The entity subtype, optional
+ * @uses $vars['entity'] Optional. Entity whose tags are being displayed (metadata ->tags)
*/
+if (isset($vars['entity'])) {
+ $defaults['value'] = $vars['entity']->tags;
+ unset($vars['entity']);
+}
+
if (!empty($vars['subtype'])) {
$subtype = "&subtype=" . urlencode($vars['subtype']);
} else {
@@ -27,6 +29,10 @@ if (empty($vars['tags']) && !empty($vars['value'])) {
$vars['tags'] = $vars['value'];
}
+if (empty($vars['tags']) && isset($vars['entity'])) {
+ $vars['tags'] = $vars['entity']->tags;
+}
+
if (!empty($vars['tags'])) {
if (!is_array($vars['tags'])) {
$vars['tags'] = array($vars['tags']);