Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

some cleanups

  • Loading branch information...
commit 305b2c6b4d8ac97247bff1f9d0be9a807972da62 1 parent e98ffe5
@dbu dbu authored
View
22 Document/ContainerBlock.php
@@ -15,7 +15,7 @@
class ContainerBlock extends BaseBlock
{
/**
- * ChildrenCollection
+ * @var ChildrenCollection
* @PHPCRODM\Children
*/
protected $children;
@@ -47,14 +47,30 @@ public function setChildren(ChildrenCollection $children)
/**
* Add a child to this container
*
- * @param BlockInterface $child
+ * @param BlockInterface $child
+ * @param string $key the collection index name to use in the
+ * child collection if not set, the child will simply be appended at
+ * the end
+ *
* @return boolean
*/
- public function addChild(BlockInterface $child)
+ public function addChild(BlockInterface $child, $key = null)
{
+ if ($key != null) {
+
+ return $this->children->set($key, $child);
+ }
+
return $this->children->add($child);
}
+ /**
+ * Alias to addChild to make the form layer happy
+ *
+ * @param BlockInterface $children
+ *
+ * @return boolean
+ */
public function addChildren(BlockInterface $children)
{
return $this->addChild($children);
View
26 Document/ImagineBlock.php
@@ -2,7 +2,9 @@
namespace Symfony\Cmf\Bundle\BlockBundle\Document;
+use Doctrine\ODM\PHPCR\Document\Image;
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
+
use Symfony\Cmf\Bundle\BlockBundle\Document\BaseBlock;
/**
@@ -14,6 +16,7 @@ class ImagineBlock extends BaseBlock
{
/**
+ * @var Image
* @PHPCRODM\Child(name="image", cascade="persist")
*/
protected $image;
@@ -21,7 +24,10 @@ class ImagineBlock extends BaseBlock
/** @PHPCRODM\String */
protected $label;
- /** @PHPCRODM\Node */
+ /**
+ * @var \PHPCR\NodeInterface
+ * @PHPCRODM\Node
+ */
protected $node;
/**
@@ -42,6 +48,18 @@ public function getLabel()
return $this->label;
}
+ /**
+ * Set the image for this block.
+ *
+ * Setting null will do nothing, as this is what happens when you edit this
+ * block in a form without uploading a replacement file.
+ *
+ * If you need to delete the Image, you can use getImage and delete it with
+ * the document manager. Note that this block does not make much sense
+ * without an image, though.
+ *
+ * @param Image $image optional the image to update
+ */
public function setImage($image)
{
if (!$image) {
@@ -55,11 +73,17 @@ public function setImage($image)
}
}
+ /**
+ * @return Image
+ */
public function getImage()
{
return $this->image;
}
+ /**
+ * @return \PHPCR\NodeInterface
+ */
public function getNode()
{
return $this->node;
View
2  Document/MultilangImagineBlock.php
@@ -5,7 +5,7 @@
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
/**
- * Block to hold an image
+ * Imagine block with multilanguage
*
* @PHPCRODM\Document(referenceable=true, translator="attribute")
*/
View
4 Document/SlideshowBlock.php
@@ -6,7 +6,9 @@
use Symfony\Cmf\Bundle\BlockBundle\Document\ContainerBlock;
/**
- * Block that renders a slideshow of child items
+ * Special container block that renders child items in a way suitable for a
+ * slideshow. Note that you need to add some javascript to actually get the
+ * blocks to do a slideshow.
*
* @PHPCRODM\Document(referenceable=true)
*/
Please sign in to comment.
Something went wrong with that request. Please try again.