/**
  * Example usage: {% set cmfMainContent = cmf_find_current_published_content(['acme_message/inbox', 'acme_message']) %}
  * This example will try to find a content at /cms/content/acme_message/inbox, update the SEO Meta data and stores
  * the content document in the cmfMainContent variable. Using 
  *     {% block html_title %}{{ sonata_seo_title() }}{% endblock html_title %}
  *     {% block html_metadatas %}{{ sonata_seo_metadatas() }}{% endblock html_metadatas %}
  * in a parent will apply the seo meta data from the page.
  * */
 public function findCurrentPublishedCMFContent($optionalContentNames)
 {
     if (!is_array($optionalContentNames)) {
         $optionalContentNames = array($optionalContentNames);
     }
     $match = null;
     foreach ($optionalContentNames as $contentName) {
         $contentPath = substr($contentName, 0, 1) !== '/' ? $this->defaultContentPath . "/" . $contentName : $contentName;
         $content = $this->helper->find($contentPath);
         if ($content && $this->helper->isPublished($content)) {
             $this->seoPresentation->updateSeoPage($content);
             $match = $content;
             break;
         }
     }
     return $match;
 }
 /**
  * @dataProvider getNextLinkableData
  */
 public function testGetNextLinkable($expected, $path, $anchor = null, $depth = null)
 {
     $next = $this->helper->getNextLinkable($path, $anchor, $depth);
     if (null === $expected) {
         $this->assertNull($next);
     } else {
         $this->assertInstanceOf('Symfony\\Cmf\\Bundle\\CoreBundle\\Tests\\Resources\\Document\\RouteAware', $next);
         $this->assertEquals($expected, $next->getId());
     }
 }
Beispiel #3
0
 public function testGetLinkableChildren()
 {
     $this->assertEquals(array(), $this->extension->getLinkableChildren(null));
     $this->markTestIncomplete('TODO: write test');
 }