Source of file EditableFieldCheckboxGroup.php
Size: 0,934 Bytes - Last Modified: 2021-12-23T10:19:50+00:00
/var/www/docs.ssmods.com/process/src/code/extensions/editablefields/EditableFieldCheckboxGroup.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344 | <?php /** * @author Mohamed Alsharaf <mohamed.alsharaf@gmail.com> */ class EditableFieldCheckboxGroupExtension extends DataExtension { /** * Get field value that is suitable for the view template file. * * @return ArrayList */ public function getViewValue() { $values = explode(',', $this->owner->Value); $value = new ArrayList(); array_walk($values, function ($item) use ($value) { $value->push(['name' => $item]); }); return $value; } /** * Get string value of a field. * * @return null|string */ public function getValueAsString() { $return = ''; $this->getViewValue()->each(function (ArrayData $item) use (&$return) { if ($return) { $return .= ', '; } $return .= $item->getField('name'); }); return $return; } } |