Source of file ReadonlyTagField.php
Size: 0,870 Bytes - Last Modified: 2021-12-23T10:35:23+00:00
/var/www/docs.ssmods.com/process/src/src/ReadonlyTagField.php
1234567891011121314151617181920212223242526272829303132333435363738394041 | <?php namespace SilverStripe\TagField; use SilverStripe\Forms\ReadonlyField; /** * A readonly extension of TagField useful for non-editable items within the CMS. * * @package forms * @subpackage fields */ class ReadonlyTagField extends TagField { /** * {@inheritDoc} */ protected $readonly = true; /** * Render the readonly field as HTML. * * @param array $properties * @return HTMLText */ public function Field($properties = array()) { $options = array(); foreach ($this->getOptions()->filter('Selected', true) as $option) { $options[] = $option->Title; } $field = ReadonlyField::create($this->name . '_Readonly', $this->title); $field->setForm($this->form); $field->setValue(implode(', ', $options)); return $field->Field(); } } |