Symfony CMF ActionBlock routing

52 views Asked by At

I am using Symfony CMF 1.2 and I need to control how URLs redirect within a rendered twig through an ActionBlock.

I have a ProductBundle that handles 3rd party calls, does some processing and uses a twig file to render the output. Now in Symfony CMF I created an ActionBlock, called Product bundle controller's action via the ActionBlock and displayed the rendering in a page. So far so good. The issue is that in the rendered output there are links pointing to specific pages. For example my rendered output is a list of products and each product has a URL pointing towards it's specific page on my website. When I click on one of those links, it goes directly to the page, not within the ActionBlock, which for example gives me a page with only the product details without header and footer. What I want to know is how to configure the platform/block to go to URLs while still staying within the ActionBlock. If you consider the ActionBlock as an iframe, I need links clicked inside the iframe to load inside itself, in a nutshell.

I have tired looking at main Symfony CMF documentation and Google results but do not seem to find any relevant information on this.

Sample ActionBlock:

$block = new ProductBlock();
$block->setEnabled(true);
$block->setPublishable(true);
$block->setPublishStartDate(new \DateTime());
$block->setParentDocument($parentDocumentBlock);
$block->setActionName('xxProductBundle:Front:index');
$block->setName('product-block');
$this->documentManager->persist($block);

Embedded in page like this:

$page->setBody("<p>Block: %embed-block|/cms/xx/block/product-block|end%</p>");

ProductBlock:

class ProductBlock extends ActionBlock
{
    public function setIsPublishable($publishable)
    {
        $this->setPublishable($publishable);
    }
}
0

There are 0 answers