Source of file StylingOptionsetField.php
Size: 0,784 Bytes - Last Modified: 2021-12-24T06:47:59+00:00
/var/www/docs.ssmods.com/process/src/src/Forms/StylingOptionsetField.php
12345678910111213141516171819202122232425262728293031 | <?php namespace Fractas\ElementalStylings\Forms; use SilverStripe\Forms\FormField; use SilverStripe\Forms\OptionsetField; use SilverStripe\ORM\ArrayList; use SilverStripe\View\Requirements; class StylingOptionsetField extends OptionsetField { public function Field($properties = []) { $options = []; $odd = false; foreach ($this->getSourceEmpty() as $value => $title) { $odd = !$odd; $options[] = $this->getFieldOption($value, $title, $odd); } $properties = array_merge($properties, [ 'Options' => new ArrayList($options), ]); Requirements::javascript('fractas/elemental-stylings:client/dist/js/StylingOptionsetField.js'); return FormField::Field($properties); } } |