src/Contao/View/Contao2BackendView/TreePicker.php
public function renderItemsPlain()
    {
        $values     = [];
        $value      = $this->varValue;
        $idProperty = $this->idProperty ?: 'id';

        if ('radio' === $this->fieldType && !empty($value)) {
            $value = (array) $value;
        }

        if (\is_array($value) && !empty($value)) {
            $environment = $this->getEnvironment();
            $dataDriver  = $environment->getDataProvider();
            $config      = $environment->getBaseConfigRegistry()->getBaseConfig();
            $filter      = FilterBuilder::fromArrayForRoot()
                ->getFilter()
                ->andPropertyValueIn($idProperty, $value)
                ->getAllAsArray();

            $config->setFilter($filter);

            // Set the sort field.
            if ($this->orderField && $dataDriver->fieldExists($this->orderField)) {
                $config->setSorting([$this->orderField => 'ASC']);
            }

            foreach ($dataDriver->fetchAll($config) as $model) {
                $formatted        = $this->formatModel($model, false);
                $idValue          = $model->getProperty($idProperty);
                $values[$idValue] = $formatted[0]['content'];
            }

            // Apply a custom sort order.
            $values = $this->sortValues($values);
        }

        return $values;
    }
public function renderItemsPlain()
    {
        $values     = [];
        $value      = $this->varValue;
        $idProperty = $this->idProperty ?: 'id';

        if ('radio' === $this->fieldType && !empty($value)) {
            $value = (array) $value;
        }

        if (\is_array($value) && !empty($value)) {
            $environment = $this->getEnvironment();
            $dataDriver  = $environment->getDataProvider();
            $config      = $environment->getBaseConfigRegistry()->getBaseConfig();
            $filter      = FilterBuilder::fromArrayForRoot()
                ->getFilter()
                ->andPropertyValueIn($idProperty, $value)
                ->getAllAsArray();

            $config->setFilter($filter);

            // Set the sort field.
            if ($this->orderField && $dataDriver->fieldExists($this->orderField)) {
                $config->setSorting([$this->orderField => 'ASC']);
            }

            foreach ($dataDriver->fetchAll($config) as $model) {
                $formatted        = $this->formatModel($model, false);
                $idValue          = $model->getProperty($idProperty);
                $values[$idValue] = $formatted[0]['content'];
            }

            // Apply a custom sort order.
            $values = $this->sortValues($values);
        }

        return $values;
    }
public function renderItemsPlain ( ) { $ values = [ ] ; $ value = $ this -> varValue ; $ idProperty = $ this -> idProperty ? : 'id' ; if ( 'radio' === $ this -> fieldType && ! empty ( $ value ) ) { $ value = ( array ) $ value ; } if ( \ is_array ( $ value ) && ! empty ( $ value ) ) { $ environment = $ this -> getEnvironment ( ) ; $ dataDriver = $ environment -> getDataProvider ( ) ; $ config = $ environment -> getBaseConfigRegistry ( ) -> getBaseConfig ( ) ; $ filter = FilterBuilder :: fromArrayForRoot ( ) -> getFilter ( ) -> andPropertyValueIn ( $ idProperty , $ value ) -> getAllAsArray ( ) ; $ config -> setFilter ( $ filter ) ; // Set the sort field. if ( $ this -> orderField && $ dataDriver -> fieldExists ( $ this -> orderField ) ) { $ config -> setSorting ( [ $ this -> orderField => 'ASC' ] ) ; } foreach ( $ dataDriver -> fetchAll ( $ config ) as $ model ) { $ formatted = $ this -> formatModel ( $ model , false ) ; $ idValue = $ model -> getProperty ( $ idProperty ) ; $ values [ $ idValue ] = $ formatted [ 0 ] [ 'content' ] ; } // Apply a custom sort order. $ values = $ this -> sortValues ( $ values ) ; } return $ values ; }
Render the current values for listing.

@return array

@SuppressWarnings(PHPMD.CyclomaticComplexity)
Render the current values for listing .