src/ngrest/plugins/CheckboxRelation.php
private function getOptionsData($event)
    {
        $items = [];
        
        foreach ($this->model->find()->asArray($this->asArray)->all() as $item) {
            if (is_callable($this->labelField, false)) {
                $label = call_user_func($this->labelField, $item);
            } else {
                if ($this->labelField === null) {
                    $this->labelField = array_keys($item);
                }
                $array = ArrayHelper::filter($item, $this->labelField);
                
                foreach ($array as $key => $value) {
                    if ($event->sender->isI18n($key)) {
                        $array[$key] = I18n::decodeFindActive($value);
                    }
                }
                
                $label = $this->labelTemplate ? vsprintf($this->labelTemplate, $array) : implode(', ', $array);
            }
        
            $items[] = ['value' => (int) $item[$this->modelPrimaryKey], 'label' => $label];
        }
        
        return ['items' => $items];
    }
private function getOptionsData($event)
    {
        $items = [];
        
        foreach ($this->model->find()->asArray($this->asArray)->all() as $item) {
            if (is_callable($this->labelField, false)) {
                $label = call_user_func($this->labelField, $item);
            } else {
                if ($this->labelField === null) {
                    $this->labelField = array_keys($item);
                }
                $array = ArrayHelper::filter($item, $this->labelField);
                
                foreach ($array as $key => $value) {
                    if ($event->sender->isI18n($key)) {
                        $array[$key] = I18n::decodeFindActive($value);
                    }
                }
                
                $label = $this->labelTemplate ? vsprintf($this->labelTemplate, $array) : implode(', ', $array);
            }
        
            $items[] = ['value' => (int) $item[$this->modelPrimaryKey], 'label' => $label];
        }
        
        return ['items' => $items];
    }
private function getOptionsData ( $ event ) { $ items = [ ] ; foreach ( $ this -> model -> find ( ) -> asArray ( $ this -> asArray ) -> all ( ) as $ item ) { if ( is_callable ( $ this -> labelField , false ) ) { $ label = call_user_func ( $ this -> labelField , $ item ) ; } else { if ( $ this -> labelField === null ) { $ this -> labelField = array_keys ( $ item ) ; } $ array = ArrayHelper :: filter ( $ item , $ this -> labelField ) ; foreach ( $ array as $ key => $ value ) { if ( $ event -> sender -> isI18n ( $ key ) ) { $ array [ $ key ] = I18n :: decodeFindActive ( $ value ) ; } } $ label = $ this -> labelTemplate ? vsprintf ( $ this -> labelTemplate , $ array ) : implode ( ', ' , $ array ) ; } $ items [ ] = [ 'value' => ( int ) $ item [ $ this -> modelPrimaryKey ] , 'label' => $ label ] ; } return [ 'items' => $ items ] ; }
Get the options data to display.

@return array
Get the options data to display .