src/Contao/View/Contao2BackendView/FileSelect.php
private function prepareFileSelector(ModelIdInterface $modelId, Ajax $ajax = null)
    {
        $inputProvider = $this->itemContainer->getEnvironment()->getInputProvider();
        $propertyName  = $inputProvider->getParameter('field');
        $information   = (array) $GLOBALS['TL_DCA'][$modelId->getDataProviderName()]['fields'][$propertyName];

        if (!isset($information['eval'])) {
            $information['eval'] = [];
        }

        // Merge with the information from the data container.
        $property = $this
            ->itemContainer
            ->getEnvironment()
            ->getDataDefinition()
            ->getPropertiesDefinition()
            ->getProperty($propertyName);
        $extra    = $property->getExtra();

        $information['eval'] = \array_merge($extra, (array) $information['eval']);

        $this->session->set('filePickerRef', Environment::get('request'));

        $combat = new DcCompat($this->itemContainer->getEnvironment(), $this->getActiveModel($modelId), $propertyName);

        /** @var FileSelector $fileSelector */
        $fileSelector = new $GLOBALS['BE_FFL']['fileSelector'](
            Widget::getAttributesFromDca(
                $information,
                $propertyName,
                $this->prepareValuesForFileSelector($propertyName, $modelId, $combat),
                $propertyName,
                $modelId->getDataProviderName(),
                $combat
            ),
            $combat
        );

        // AJAX request.
        if ($ajax) {
            $ajax->executePostActions($combat);
        }

        return $fileSelector;
    }
private function prepareFileSelector(ModelIdInterface $modelId, Ajax $ajax = null)
    {
        $inputProvider = $this->itemContainer->getEnvironment()->getInputProvider();
        $propertyName  = $inputProvider->getParameter('field');
        $information   = (array) $GLOBALS['TL_DCA'][$modelId->getDataProviderName()]['fields'][$propertyName];

        if (!isset($information['eval'])) {
            $information['eval'] = [];
        }

        // Merge with the information from the data container.
        $property = $this
            ->itemContainer
            ->getEnvironment()
            ->getDataDefinition()
            ->getPropertiesDefinition()
            ->getProperty($propertyName);
        $extra    = $property->getExtra();

        $information['eval'] = \array_merge($extra, (array) $information['eval']);

        $this->session->set('filePickerRef', Environment::get('request'));

        $combat = new DcCompat($this->itemContainer->getEnvironment(), $this->getActiveModel($modelId), $propertyName);

        /** @var FileSelector $fileSelector */
        $fileSelector = new $GLOBALS['BE_FFL']['fileSelector'](
            Widget::getAttributesFromDca(
                $information,
                $propertyName,
                $this->prepareValuesForFileSelector($propertyName, $modelId, $combat),
                $propertyName,
                $modelId->getDataProviderName(),
                $combat
            ),
            $combat
        );

        // AJAX request.
        if ($ajax) {
            $ajax->executePostActions($combat);
        }

        return $fileSelector;
    }
private function prepareFileSelector ( ModelIdInterface $ modelId , Ajax $ ajax = null ) { $ inputProvider = $ this -> itemContainer -> getEnvironment ( ) -> getInputProvider ( ) ; $ propertyName = $ inputProvider -> getParameter ( 'field' ) ; $ information = ( array ) $ GLOBALS [ 'TL_DCA' ] [ $ modelId -> getDataProviderName ( ) ] [ 'fields' ] [ $ propertyName ] ; if ( ! isset ( $ information [ 'eval' ] ) ) { $ information [ 'eval' ] = [ ] ; } // Merge with the information from the data container. $ property = $ this -> itemContainer -> getEnvironment ( ) -> getDataDefinition ( ) -> getPropertiesDefinition ( ) -> getProperty ( $ propertyName ) ; $ extra = $ property -> getExtra ( ) ; $ information [ 'eval' ] = \ array_merge ( $ extra , ( array ) $ information [ 'eval' ] ) ; $ this -> session -> set ( 'filePickerRef' , Environment :: get ( 'request' ) ) ; $ combat = new DcCompat ( $ this -> itemContainer -> getEnvironment ( ) , $ this -> getActiveModel ( $ modelId ) , $ propertyName ) ; /** @var FileSelector $fileSelector */ $ fileSelector = new $ GLOBALS [ 'BE_FFL' ] [ 'fileSelector' ] ( Widget :: getAttributesFromDca ( $ information , $ propertyName , $ this -> prepareValuesForFileSelector ( $ propertyName , $ modelId , $ combat ) , $ propertyName , $ modelId -> getDataProviderName ( ) , $ combat ) , $ combat ) ; // AJAX request. if ( $ ajax ) { $ ajax -> executePostActions ( $ combat ) ; } return $ fileSelector ; }
Prepare the file selector.

@param ModelIdInterface $modelId The model identifier.
@param Ajax             $ajax    The ajax request.

@return FileSelector

@SuppressWarnings(PHPMD.Superglobals)
Prepare the file selector .