Permalink
Browse files

Introduced editable Block

  • Loading branch information...
1 parent 07b4888 commit fdd701be3e1b4bae1bce0e50596c764fdaa6db51 @elHornair elHornair committed Apr 27, 2012
View
@@ -37,6 +37,7 @@ public function registerBundles()
new Sandbox\MainBundle\SandboxMainBundle(),
new Sandbox\TestBundle\SandboxTestBundle(),
new Sandbox\AdminBundle\SandboxAdminBundle(),
+ new Sandbox\BlockBundle\SandboxBlockBundle(),
// admin bundle
new Sonata\jQueryBundle\SonatajQueryBundle(),
@@ -0,0 +1,23 @@
+<?php
+
+namespace Sandbox\BlockBundle\Document;
+
+use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM,
+ Symfony\Cmf\Bundle\BlockBundle\Document\SimpleBlock,
+ Liip\VieBundle\FromJsonLdInterface;
+
+/**
+ * Editable block with hypertext and a title
+ *
+ * @PHPCRODM\Document(referenceable=true)
+ */
+class EditableSimpleBlock extends SimpleBlock implements FromJsonLdInterface
+{
+
+ public function fromJsonLd($data)
+ {
+ $this->setTitle($data['<http://purl.org/dc/terms/title>']);
+ $this->setContent($data['<http://rdfs.org/sioc/ns#content>']);
+ }
+
+}
@@ -0,0 +1,13 @@
+ {% extends 'SymfonyCmfBlockBundle:Block:block_base.html.twig' %}
+
+{% block block %}
+ <div xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/"
+ typeof="sioc:Post"
+ about="{{ block.id }}"
+ class="articleContainer">
+
+ <h1 id="main_title" property="dcterms:title">{{ block.title|raw }}</h1>
+ <div property="sioc:content">{{ block.content|raw }}</div>
+
+ </div>
+{% endblock %}
@@ -0,0 +1,13 @@
+<?php
+
+namespace Sandbox\BlockBundle;
+
+use Symfony\Component\HttpKernel\Bundle\Bundle;
+
+class SandboxBlockBundle extends Bundle
+{
+ public function getParent()
+ {
+ return 'SymfonyCmfBlockBundle';
+ }
+}
@@ -26,12 +26,12 @@ static:
class: Symfony\Cmf\Bundle\BlockBundle\Document\ContainerBlock
children:
child1:
- class: Symfony\Cmf\Bundle\BlockBundle\Document\SimpleBlock
+ class: Sandbox\BlockBundle\Document\EditableSimpleBlock
properties:
title: Homepage Simpleblock
content: This is a simple block on the homepage.
child2:
- class: Symfony\Cmf\Bundle\BlockBundle\Document\SimpleBlock
+ class: Sandbox\BlockBundle\Document\EditableSimpleBlock
properties:
title: Another SimpleBlock
content: This is another simple block.

0 comments on commit fdd701b

Please sign in to comment.