/** * {@inheritdoc} */ public function getPersistentParameters() { $parameters = parent::getPersistentParameters(); if (!$this->hasRequest()) { return $parameters; } if ($filter = $this->getRequest()->get('filter') && isset($filter['context'])) { $context = $filter['context']['value']; } else { $context = $this->getRequest()->get('context', false); $available_contexts = array_map(function ($c) { return $c->getId(); }, $this->getContextList()); if (!$context || !in_array($context, $available_contexts)) { $context = $available_contexts[0]; } } $providers = $this->pool->getProvidersByContext($context); $provider = $this->getRequest()->get('provider'); // if the context has only one provider, set it into the request // so the intermediate provider selection is skipped if (count($providers) == 1 && null === $provider) { $provider = array_shift($providers)->getName(); $this->getRequest()->query->set('provider', $provider); } $categoryId = $this->getRequest()->get('category'); if (!$categoryId) { $categoryId = $this->categoryManager->getRootCategory($context)->getId(); } return array_merge($parameters, array('provider' => $provider, 'context' => $context, 'category' => $categoryId, 'hide_context' => (bool) $this->getRequest()->get('hide_context'))); }
public function getFilterParameters() { $parameters = parent::getFilterParameters(); // TODO: Change the autogenerated stub if (!empty($parameters['context']['value']) && $parameters['context']['value'] == 'profile') { $parameters['user']['value'] = AppRouteAction::getUserId(); } return $parameters; }
/** * @param string $code * @param string $class * @param string $baseControllerName * @param Pool $pool * @param CategoryManagerInterface $categoryManager */ public function __construct($code, $class, $baseControllerName, Pool $pool, CategoryManagerInterface $categoryManager) { $this->maxPerPage = 8; $this->perPageOptions = array(8, 12, 16, 32); parent::__construct($code, $class, $baseControllerName, $pool, $categoryManager); }
public function getFormTheme() { return array_merge(parent::getFormTheme(), array('ApplicationSonataMediaBundle:Form:fields.html.twig')); }