Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F802431
D213.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Feb 23, 11:15 PM
Size
1 KB
Mime Type
text/x-diff
Expires
Mon, Feb 24, 11:15 PM (10 h, 46 m)
Engine
blob
Format
Raw Data
Handle
575352
Attached To
D213: INP-1547 Create "promo-block:ImageField" tag
D213.diff
View Options
Index: branches/5.3.x/core/units/promo_blocks/promo_block_tp.php
===================================================================
--- branches/5.3.x/core/units/promo_blocks/promo_block_tp.php
+++ branches/5.3.x/core/units/promo_blocks/promo_block_tp.php
@@ -88,4 +88,36 @@
return isset($group_data[$setting_name]) ? $group_data[$setting_name] : '';
}
+
+ /**
+ * Image Field
+ *
+ * @param array $params Tag params.
+ *
+ * @return string
+ */
+ protected function ImageField(array $params)
+ {
+ $field = $this->SelectParam($params, 'name,field');
+
+ if ( !$field ) {
+ $field = 'Image';
+ }
+
+ /** @var kMultiLanguage $multi_language_formatter */
+ $multi_language_formatter = $this->Application->recallObject('kMultiLanguage');
+ $current_language_field = $multi_language_formatter->LangFieldname($field);
+
+ /** @var kDBItem $object */
+ $object = $this->getObject($params);
+
+ if ( !$object->GetDBField($current_language_field) ) {
+ $current_language_field = $multi_language_formatter->LangFieldname($field, true);
+ }
+
+ $params['name'] = $current_language_field;
+
+ return $this->Field($params);
+ }
+
}
Event Timeline
Log In to Comment