protected function singleResult($data = [], $singleMode = false)
    {
        $result = $data;
        if (empty($result['id'])) {
            $result['id'] = uniqid();
        }
        if (empty($result['mark']) || !in_array($result['mark'], [0, 1])) {
            $result['mark'] = 0;
        }
        if (empty($result['value']) || !is_string($result['value'])) {
            $result['value'] = 'error: missing value key in data array';
        }
        if (isset($result['additional']) && $result['additional'] !== false) {
            if (empty($result['additional']) || !is_string($result['additional'])) {
                $result['additional'] = '';
            }
        } else {
            $result['additional'] = '';
        }
        if (!empty($this->removeLabel) && is_string($this->removeLabel)) {
            $result['removeLabel'] = $this->removeLabel;
        } else {
            $result['removeLabel'] = $this->bootstrapDefaults['removeLabel'];
        }

        $result['arrayMode'] = '[]';
        if ($singleMode) {
            $result['arrayMode'] = '';
        }

        $result['htmlOptionsResult'] = $this->htmlOptionsResult($result['id']);
        $result['htmlOptionsRemove'] = $this->htmlOptionsRemove($result['id']);
        
        $result['markBegin'] = $this->prepareOption('markBegin');
        $result['markEnd']   = $this->prepareOption('markEnd');
        
        $result['model']     = $this->model;
        $result['attribute'] = $this->attribute;
        $result['name']      = $this->name;        
        
        return $result;
    }
protected function singleResult($data = [], $singleMode = false)
    {
        $result = $data;
        if (empty($result['id'])) {
            $result['id'] = uniqid();
        }
        if (empty($result['mark']) || !in_array($result['mark'], [0, 1])) {
            $result['mark'] = 0;
        }
        if (empty($result['value']) || !is_string($result['value'])) {
            $result['value'] = 'error: missing value key in data array';
        }
        if (isset($result['additional']) && $result['additional'] !== false) {
            if (empty($result['additional']) || !is_string($result['additional'])) {
                $result['additional'] = '';
            }
        } else {
            $result['additional'] = '';
        }
        if (!empty($this->removeLabel) && is_string($this->removeLabel)) {
            $result['removeLabel'] = $this->removeLabel;
        } else {
            $result['removeLabel'] = $this->bootstrapDefaults['removeLabel'];
        }

        $result['arrayMode'] = '[]';
        if ($singleMode) {
            $result['arrayMode'] = '';
        }

        $result['htmlOptionsResult'] = $this->htmlOptionsResult($result['id']);
        $result['htmlOptionsRemove'] = $this->htmlOptionsRemove($result['id']);
        
        $result['markBegin'] = $this->prepareOption('markBegin');
        $result['markEnd']   = $this->prepareOption('markEnd');
        
        $result['model']     = $this->model;
        $result['attribute'] = $this->attribute;
        $result['name']      = $this->name;        
        
        return $result;
    }
protected function singleResult ( $ data = [ ] , $ singleMode = false ) { $ result = $ data ; if ( empty ( $ result [ 'id' ] ) ) { $ result [ 'id' ] = uniqid ( ) ; } if ( empty ( $ result [ 'mark' ] ) || ! in_array ( $ result [ 'mark' ] , [ 0 , 1 ] ) ) { $ result [ 'mark' ] = 0 ; } if ( empty ( $ result [ 'value' ] ) || ! is_string ( $ result [ 'value' ] ) ) { $ result [ 'value' ] = 'error: missing value key in data array' ; } if ( isset ( $ result [ 'additional' ] ) && $ result [ 'additional' ] !== false ) { if ( empty ( $ result [ 'additional' ] ) || ! is_string ( $ result [ 'additional' ] ) ) { $ result [ 'additional' ] = '' ; } } else { $ result [ 'additional' ] = '' ; } if ( ! empty ( $ this -> removeLabel ) && is_string ( $ this -> removeLabel ) ) { $ result [ 'removeLabel' ] = $ this -> removeLabel ; } else { $ result [ 'removeLabel' ] = $ this -> bootstrapDefaults [ 'removeLabel' ] ; } $ result [ 'arrayMode' ] = '[]' ; if ( $ singleMode ) { $ result [ 'arrayMode' ] = '' ; } $ result [ 'htmlOptionsResult' ] = $ this -> htmlOptionsResult ( $ result [ 'id' ] ) ; $ result [ 'htmlOptionsRemove' ] = $ this -> htmlOptionsRemove ( $ result [ 'id' ] ) ; $ result [ 'markBegin' ] = $ this -> prepareOption ( 'markBegin' ) ; $ result [ 'markEnd' ] = $ this -> prepareOption ( 'markEnd' ) ; $ result [ 'model' ] = $ this -> model ; $ result [ 'attribute' ] = $ this -> attribute ; $ result [ 'name' ] = $ this -> name ; return $ result ; }
Renders single preselected value result.
@param array $data Preselected value data array
@param boolean $singleMode Whether to render hidden output field as
single one or as part of tabular data collection
@return array
Renders single preselected value result .