]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Added entity keyword to ECML. (NB: The old entity keyword is now entity_list)
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 3 Jun 2010 15:37:23 +0000 (15:37 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 3 Jun 2010 15:37:23 +0000 (15:37 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6343 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/ecml/README.txt
mod/ecml/ecml_functions.php
mod/ecml/start.php
mod/ecml/views/default/ecml/keywords/entity.php [new file with mode: 0644]

index 63a9aacdcc11ce12fd649d0e4038b6ef46979834..7d59d6dbcdcd41b912373e6ccc5f6852caa155d0 100644 (file)
@@ -191,7 +191,7 @@ CONTENTS:
 
        view object/blog:
                ...logic...
-               elgg_view('blog/blog', array('blog' => $blog);
+               echo elgg_view('blog/blog', array('blog' => $blog);
                ...logic...
                elgg_view_comments($blog);
 
index 7a30cde16c49904c6c30c4518ee91dfadeb8ef33..eba8460b2613d1ffc294636af1bbfec6fccb0518 100644 (file)
@@ -30,7 +30,7 @@ function ecml_parse_view_match($matches) {
        }
 
        switch ($keyword) {
-               case 'entity':
+               case 'entity_list':
                        $options = ecml_keywords_parse_entity_params($params_string);
                        // must use this lower-level function because I missed refactoring
                        // the list entity functions for relationships.
@@ -61,6 +61,8 @@ function ecml_parse_view_match($matches) {
        }
 
        // if nothing matched return the original string.
+       // @todo this might be undesirable.  will show ugly code everywhere
+       // if you delete a file or something.
        if (!$content) {
                $content = $matches[0];
        }
@@ -219,4 +221,4 @@ function ecml_is_valid_keyword($keyword, $view = NULL) {
        }
 
        return $r;
-}
\ No newline at end of file
+}
index c0ce1d4d65654a941b1a276f78d20b01983f583d..d2adeca631706e543ab052e6edfd4959f08af4b5 100644 (file)
@@ -149,7 +149,8 @@ function ecml_keyword_hook($hook, $type, $value, $params) {
                'blip.tv',
                'dailymotion',
                'livevideo',
-               'redlasso'
+               'redlasso',
+               'entity'
        );
 
        foreach ($keywords as $keyword) {
diff --git a/mod/ecml/views/default/ecml/keywords/entity.php b/mod/ecml/views/default/ecml/keywords/entity.php
new file mode 100644 (file)
index 0000000..47d0244
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+/**
+ * ECML Generic Object GUID
+ *
+ * @package ECML
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
+
+$guid = $vars['guid'];
+
+if ($entity = get_entity($guid)) {
+       echo elgg_view('output/url', array(
+               'href' => $entity->getURL(),
+               'title' => $entity->title,
+               'text' => "<img src={$entity->getIcon('tiny')}>" . $entity->title
+       ));
+} else {
+       echo elgg_echo('ecml:entity:invalid');
+}
\ No newline at end of file