sonata-project/SonataPageBundle — Issue #28: actionBlockService Parameters not available
Author: itze88
Created: 2012-01-02 15:23:50+00:00
State: open

Hi there,

i don't know if it is my fault but wenn i add a ActionBlock to one of my Containers everything is fine only the Parameters are not available in my action.

In the Function execute in Block/actionBlockService my Parameters are available but they are not available in my action.

public function execute(CmsManagerInterface $manager, BlockInterface $block, PageInterface $page, Response $response = null)
{
$parameters = (array)json_decode($block->getSetting('parameters'), true);
//Here i can make a print_r($parameters) and everything is fine!
$parameters = array_merge($parameters, array('_block' => $block, '_page' => $page));
$settings = array_merge($this->getDefaultSettings(), (array)$block->getSettings());
try {
$actionContent = $this->kernel->render($settings['action'], $parameters);
} catch (\Exception $e) {
throw $e;
}

$content = Mustache::replace($block->getSetting('layout'), array(
'CONTENT' => $actionContent
));

return $this->renderResponse('SonataPageBundle:Block:block_core_action.html.twig', array(
'content' => $content,
'block' => $block,
'page' => $page,
), $response);
}

Is this an Issue in the kernel->render function?

My Action looks like these:

public function sliderAction()
{
$request = $this->get('request');
$main_feeds = $request->request->get('main_feeds');
}

And the Parameters are defined in the Container:
{"main_feeds":"Tv"}

Best regards
Itze