Created
July 11, 2015 16:26
-
-
Save helios-ag/dcb2ed44e2317a5e4193 to your computer and use it in GitHub Desktop.
ConfigurationReader short
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Service; | |
use FM\ElfinderBundle\Configuration\ElFinderConfigurationReader; | |
use FM\ElfinderBundle\Model\ElFinderConfigurationProviderInterface; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
use Symfony\Component\HttpFoundation\RequestStack; | |
class ConfigurationReader extends ElFinderConfigurationReader | |
{ | |
/** | |
* @param $instance | |
* @return array | |
*/ | |
public function getConfiguration($instance) | |
{ | |
... | |
foreach ($parameters['connector']['roots'] as $parameter) { | |
$path = $parameter['path']; | |
$homeFolder = $this->container->get('security.token_storage')->getToken()->getUser()->getUsername(); | |
$driver = $this->container->has($parameter['driver']) ? $this->container->get($parameter['driver']) : null; | |
$driverOptions = array( | |
... | |
'path' => $path .'/'. $homeFolder, | |
... | |
); | |
if(!$parameter['show_hidden']) { | |
$driverOptions['accessControl'] = array($this, 'access'); | |
}; | |
if($parameter['driver'] == 'Flysystem') { | |
$driverOptions['filesystem'] = $filesystem; | |
} | |
$options['roots'][] = array_merge($driverOptions, $this->configureDriver($parameter)); | |
} | |
return $options; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment