Jatin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/154788

Change subject: Tokens - searching wiki for full image URL if image name 
retrieved using ED
......................................................................

Tokens - searching wiki for full image URL if image name retrieved using ED

Change-Id: I1cdf8f770778b690a63615b4c7cbba2379d0474b
---
M includes/forminputs/SF_TokensInput.php
1 file changed, 15 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/88/154788/1

diff --git a/includes/forminputs/SF_TokensInput.php 
b/includes/forminputs/SF_TokensInput.php
index 8ac994e..26be470 100644
--- a/includes/forminputs/SF_TokensInput.php
+++ b/includes/forminputs/SF_TokensInput.php
@@ -64,7 +64,21 @@
                                $sfgEDSettings[$name]['title'] = 
$other_args['values from external data'];
                        }
                        if ( array_key_exists( 'image', $other_args ) ) {
-                               $sfgEDSettings[$name]['image'] = 
$other_args['image'];
+                               $image_param =  $other_args['image'];
+                               $sfgEDSettings[$name]['image'] = $image_param;
+                               global $edgValues;
+                               for ($i = 0; $i < 
count($edgValues[$image_param]); $i++) {
+                                       $image = $edgValues[$image_param][$i];
+                                       if ( strpos( $image, "http" ) !== 0 ) {
+                                               $file = wfFindFile( $image );
+                                               if ( $file ) {
+                                                       $url = 
$file->getFullUrl();
+                                                       
$edgValues[$image_param][$i] = $url;
+                                               } else {
+                                                       
$edgValues[$image_param][$i] = "";
+                                               }
+                                       }
+                               }
                        }
                        if ( array_key_exists( 'description', $other_args ) ) {
                                $sfgEDSettings[$name]['description'] = 
$other_args['description'];

-- 
To view, visit https://gerrit.wikimedia.org/r/154788
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1cdf8f770778b690a63615b4c7cbba2379d0474b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Jatin <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to