src/Fields/MultiValueCheckboxField.php
public function performReadonlyTransformation()
    {
        $values = '';
        $data   = [];

        $items = $this->value;
        if ($this->source) {
            foreach ($this->source as $source) {
                if (is_object($source)) {
                    $sourceTitles[$source->ID] = $source->Title;
                }
            }
        }

        if ($items) {
            // Items is a DO Set
            if (is_a($items, 'DataList')) {
                foreach ($items as $item) {
                    $data[] = $item->Title;
                }
                if ($data) $values = implode(', ', $data);

                // Items is an array or single piece of string (including comma seperated string)
            } else {
                if (!is_array($items)) {
                    $items = preg_split('/ *, */', trim($items));
                }

                foreach ($items as $item) {
                    if (is_array($item)) {
                        $data[] = $item['Title'];
                    } elseif (is_array($this->source) && !empty($this->source[$item])) {
                        $data[] = $this->source[$item];
                    } elseif (is_a($this->source, 'DataList')) {
                        $data[] = $sourceTitles[$item];
                    } else {
                        $data[] = $item;
                    }
                }

                $values = implode(', ', $data);
            }
        }

        $title = ($this->title) ? $this->title : '';

        $field = new ReadonlyField($this->name, $title, $values);
        $field->setForm($this->form);

        return $field;
    }
public function performReadonlyTransformation()
    {
        $values = '';
        $data   = [];

        $items = $this->value;
        if ($this->source) {
            foreach ($this->source as $source) {
                if (is_object($source)) {
                    $sourceTitles[$source->ID] = $source->Title;
                }
            }
        }

        if ($items) {
            // Items is a DO Set
            if (is_a($items, 'DataList')) {
                foreach ($items as $item) {
                    $data[] = $item->Title;
                }
                if ($data) $values = implode(', ', $data);

                // Items is an array or single piece of string (including comma seperated string)
            } else {
                if (!is_array($items)) {
                    $items = preg_split('/ *, */', trim($items));
                }

                foreach ($items as $item) {
                    if (is_array($item)) {
                        $data[] = $item['Title'];
                    } elseif (is_array($this->source) && !empty($this->source[$item])) {
                        $data[] = $this->source[$item];
                    } elseif (is_a($this->source, 'DataList')) {
                        $data[] = $sourceTitles[$item];
                    } else {
                        $data[] = $item;
                    }
                }

                $values = implode(', ', $data);
            }
        }

        $title = ($this->title) ? $this->title : '';

        $field = new ReadonlyField($this->name, $title, $values);
        $field->setForm($this->form);

        return $field;
    }
public function performReadonlyTransformation ( ) { $ values = '' ; $ data = [ ] ; $ items = $ this -> value ; if ( $ this -> source ) { foreach ( $ this -> source as $ source ) { if ( is_object ( $ source ) ) { $ sourceTitles [ $ source -> ID ] = $ source -> Title ; } } } if ( $ items ) { // Items is a DO Set if ( is_a ( $ items , 'DataList' ) ) { foreach ( $ items as $ item ) { $ data [ ] = $ item -> Title ; } if ( $ data ) $ values = implode ( ', ' , $ data ) ; // Items is an array or single piece of string (including comma seperated string) } else { if ( ! is_array ( $ items ) ) { $ items = preg_split ( '/ *, */' , trim ( $ items ) ) ; } foreach ( $ items as $ item ) { if ( is_array ( $ item ) ) { $ data [ ] = $ item [ 'Title' ] ; } elseif ( is_array ( $ this -> source ) && ! empty ( $ this -> source [ $ item ] ) ) { $ data [ ] = $ this -> source [ $ item ] ; } elseif ( is_a ( $ this -> source , 'DataList' ) ) { $ data [ ] = $ sourceTitles [ $ item ] ; } else { $ data [ ] = $ item ; } } $ values = implode ( ', ' , $ data ) ; } } $ title = ( $ this -> title ) ? $ this -> title : '' ; $ field = new ReadonlyField ( $ this -> name , $ title , $ values ) ; $ field -> setForm ( $ this -> form ) ; return $ field ; }
Transforms the source data for this CheckboxSetField
into a comma separated list of values.

@return ReadonlyField
Transforms the source data for this CheckboxSetField into a comma separated list of values .