Source of file FrontEndVersionedImageExtension.php
Size: 1,560 Bytes - Last Modified: 2021-12-24T06:49:02+00:00
/var/www/docs.ssmods.com/process/src/code/Fields/FrontEndVersionedImageExtension.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344 | <?php if (class_exists('VersionedImageExtension')) { class FrontEndVersionedImageExtension extends VersionedImageExtension { /** * Set the value on the field. * Optionally takes the whole record as an argument, * to pick other values. * * @param mixed $value * @param array $record */ public function setValue($value, $record = null) { FrontendEditing::setValue($this, $value, $record); parent::setValue($value, $record); } /** * Returns the string which will be used in the template * @return string */ public function forTemplate() { $isEditable = FrontendEditing::editingEnabled() && FrontendEditing::isEditable($this); $value = parent::forTemplate(); echo '<pre class="debug"> "$this"'.PHP_EOL.print_r($this, true).PHP_EOL.'</pre>'; if ($isEditable) { $field = $this->scaffoldSearchField($value)-> setAttribute('data-feclass', FrontendEditing::getClassName($this))-> setAttribute('data-feid', FrontendEditing::getID($this))-> setAttribute('data-fefield', $this->name)-> setHasEmptyDefault(false)-> addExtraClass("frontend-editable frontend-editable-boolean")-> setValue($value); $value = $field->forTemplate(); } return $value; } } } |