Permalink
Browse files

Merge commit '44040e4fd6371eaf6d940a713344b13d044b6c0d'

  • Loading branch information...
rvanlaarhoven committed Jan 14, 2016
1 parent 0ae7636 commit ff9dadfad4c238c3ef09eb1a9a43a2195731b073
Showing with 6,027 additions and 1,139 deletions.
  1. +218 −0 Block/AbstractBlockService.php
  2. +31 −0 Block/BlockAdapterInterface.php
  3. +42 −0 Block/BlockContainerInterface.php
  4. +607 −0 Block/BlockManager.php
  5. +13 −0 Block/BlockOwnerInterface.php
  6. +42 −0 Block/BlockServiceInterface.php
  7. +109 −0 Block/ButtonBlockService.php
  8. +214 −0 Block/ColumnBlockService.php
  9. +160 −0 Block/ContainerBlockService.php
  10. +33 −0 Block/DocumentBlockService.php
  11. +16 −0 Block/DraftVersionInterface.php
  12. +66 −0 Block/HtmlBlockService.php
  13. +72 −0 Block/ImageBlockService.php
  14. +106 −0 Block/JumbotronBlockService.php
  15. +59 −0 Block/RecursiveBlockIterator.php
  16. +39 −0 Block/RevertVisitor.php
  17. +30 −0 Block/SortVisitor.php
  18. +13 −0 Block/Tool/ColumnTool.php
  19. +14 −0 Block/Tool/ContainerTool.php
  20. +14 −0 Block/Tool/ContentTool.php
  21. +175 −0 Block/Tool/Tool.php
  22. +16 −0 Block/Tool/ToolsetMemberInterface.php
  23. +18 −0 Block/VisitorInterface.php
  24. +0 −1 Controller/Api/ContentController.php
  25. +232 −0 Controller/Api/ContentEditorController.php
  26. +159 −88 Controller/Backend/ContentController.php
  27. +126 −0 Controller/Backend/ContentEditorController.php
  28. +104 −0 Controller/Backend/TemplateController.php
  29. +20 −21 Controller/Frontend/ContentController.php
  30. +43 −0 DependencyInjection/Compiler/BlockCompilerPass.php
  31. +2 −1 DependencyInjection/OpiferContentExtension.php
  32. +479 −0 Entity/Block.php
  33. +63 −0 Entity/BlockLogEntry.php
  34. +69 −0 Entity/ButtonBlock.php
  35. +67 −0 Entity/ColumnBlock.php
  36. +105 −0 Entity/CompositeBlock.php
  37. +56 −0 Entity/ContainerBlock.php
  38. +27 −0 Entity/DocumentBlock.php
  39. +50 −0 Entity/HtmlBlock.php
  40. +52 −0 Entity/ImageBlock.php
  41. +80 −0 Entity/JumbotronBlock.php
  42. +185 −0 Entity/Template.php
  43. +61 −0 EventListener/BlockDiscriminatorListener.php
  44. +4 −0 EventListener/Serializer/ContentEventSubscriber.php
  45. +34 −0 Filter/DraftVersionFilter.php
  46. +92 −0 Form/Type/BlockAdapterFormType.php
  47. +44 −0 Form/Type/ColumnEnumType.php
  48. +53 −0 Form/Type/ColumnGutterType.php
  49. +128 −0 Form/Type/ContentDetailsType.php
  50. +30 −0 Form/Type/ContentEditorType.php
  51. +12 −39 Form/Type/ContentType.php
  52. +59 −0 Form/Type/GutterCollectionType.php
  53. +60 −0 Form/Type/SpanCollectionType.php
  54. +25 −0 Model/BlockInterface.php
  55. +68 −228 Model/Content.php
  56. +1 −15 Model/ContentManager.php
  57. +9 −14 Model/ContentRepository.php
  58. +0 −378 Model/Layout.php
  59. +0 −8 Model/LayoutInterface.php
  60. +0 −78 Model/LayoutManager.php
  61. +7 −0 OpiferContentBundle.php
  62. +5 −0 README.md
  63. +88 −0 Repository/BlockLogEntryRepository.php
  64. +15 −0 Repository/BlockRepository.php
  65. +15 −0 Repository/TemplateRepository.php
  66. +96 −0 Resources/config/blocks.yml
  67. +42 −0 Resources/config/routing_api.yml
  68. +48 −5 Resources/config/routing_backend.yml
  69. +48 −8 Resources/config/services.yml
  70. +26 −0 Resources/doc/summary.md
  71. +2 −2 Resources/public/app/content/content.html
  72. +2 −2 Resources/public/app/content/content.js
  73. +5 −1 Resources/translations/messages.en.yml
  74. +2 −1 Resources/translations/messages.nl_NL.yml
  75. +1 −0 Resources/views/Block/Content/button.html.twig
  76. +1 −0 Resources/views/Block/Content/html.html.twig
  77. +3 −0 Resources/views/Block/Content/image.html.twig
  78. +7 −0 Resources/views/Block/Content/jumbotron.html.twig
  79. +21 −0 Resources/views/Block/Layout/layout.html.twig
  80. +1 −0 Resources/views/Block/Layout/template.html.twig
  81. +77 −0 Resources/views/Block/controls.html.twig
  82. +3 −0 Resources/views/Block/manage.html.twig
  83. +34 −0 Resources/views/Content/details.html.twig
  84. +1 −1 Resources/views/Content/edit.html.twig
  85. +2 −2 Resources/views/Content/index.html.twig
  86. +15 −16 Resources/views/Content/new.html.twig
  87. +1 −0 Resources/views/Directory/edit.html.twig
  88. +50 −0 Resources/views/Editor/edit_block.html.twig
  89. +35 −0 Resources/views/Editor/version_picker.html.twig
  90. +262 −0 Resources/views/Editor/view.html.twig
  91. +37 −0 Resources/views/Form/fields.html.twig
  92. +98 −0 Resources/views/Grid/grid.html.twig
  93. +14 −0 Resources/views/Template/index.html.twig
  94. +131 −0 RulesEngine/ContentRulesProvider.php
  95. +9 −59 Tests/Model/ContentTest.php
  96. +0 −35 Tests/Model/LayoutManagerTest.php
  97. +0 −10 Tests/TestData/Layout.php
  98. +10 −0 Tests/TestData/Schema.php
  99. +0 −10 Tests/TestData/Template.php
  100. +107 −113 Twig/ContentExtension.php
  101. +0 −3 composer.json
@@ -0,0 +1,218 @@
<?php
namespace Opifer\ContentBundle\Block;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Opifer\ContentBundle\Model\BlockInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Class AbstractBlockService
*
* @package Opifer\ContentBundle\Block
*/
abstract class AbstractBlockService
{
/** @var string */
protected $view;
/** @var string */
protected $manageView = 'OpiferContentBundle:Block:manage.html.twig';
/** @var string */
protected $editView = 'OpiferContentBundle:Editor:edit_block.html.twig';
/** @var EngineInterface */
protected $templating;
const FORM_GROUP_PROPERTIES = 'properties';
/**
* @param EngineInterface $templating
*/
public function __construct(EngineInterface $templating)
{
$this->templating = $templating;
}
/**
* {@inheritdoc}
*/
public function execute(BlockInterface $block, Response $response = null)
{
return $this->renderResponse($this->getView($block), array(
'block_service' => $this,
'block' => $block,
), $response);
}
/**
* {@inheritdoc}
*/
public function manage(BlockInterface $block, Response $response = null)
{
return $this->renderResponse($this->getManageView($block), array(
'block_service' => $this,
'block' => $block,
'block_view' => $this->getView($block),
'block_mode' => 'manage',
'manage_type' => $this->getManageFormTypeName(),
), $response);
}
/**
* {@inheritdoc}
*/
public function getName(BlockInterface $block = null)
{
return $this->name;
}
/**
* @param string $view
*
* @return $this
*/
public function setView($view)
{
$this->view = $view;
return $this;
}
/**
* {@inheritdoc}
*/
public function getView(BlockInterface $block)
{
return $this->view;
}
/**
* {@inheritdoc}
*/
public function getManageView(BlockInterface $block)
{
return $this->manageView;
}
/**
* {@inheritView}
*/
public function getEditView()
{
return $this->editView;
}
/**
* {@inheritdoc}
*/
public function getTemplating()
{
return $this->templating;
}
/**
* {@inheritdoc}
*/
public function prePersist(BlockInterface $block)
{
}
/**
* {@inheritdoc}
*/
public function postPersist(BlockInterface $block)
{
}
/**
* {@inheritdoc}
*/
public function preUpdate(BlockInterface $block)
{
}
/**
* {@inheritdoc}
*/
public function postUpdate(BlockInterface $block)
{
}
/**
* {@inheritdoc}
*/
public function preRemove(BlockInterface $block)
{
}
/**
* {@inheritdoc}
*/
public function postRemove(BlockInterface $block)
{
}
/**
* {@inheritdoc}
*/
public function load(BlockInterface $block)
{
}
/**
* {@inheritdoc}
*/
public function buildManageForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('save', 'submit', [
'label' => 'button.submit'
]);
}
// public function buildPropertiesForm(FormBuilderInterface $builder, array $options)
// {
// return $builder->create('properties', 'form')
// ->add('id', 'text')
// ->add('extra_classes', 'text');
// }
/**
* Configures the options for this type. (replaces the setDefaultOptions
* method that was deprecated since Symfony 2.7)
*
* @param OptionsResolver $resolver The resolver for the options.
*/
public function configureManageOptions(OptionsResolver $resolver)
{
}
/**
* BlockAdapterFormType calls this method to get the name of the FormType.
*
* @return string
*/
public function getManageFormTypeName()
{
return 'default';
}
/**
* Returns a Response object that can be cache-able.
*
* @param string $view
* @param array $parameters
* @param Response $response
*
* @return Response
*/
public function renderResponse($view, array $parameters = array(), Response $response = null)
{
return $this->getTemplating()->renderResponse($view, $parameters, $response);
}
}
@@ -0,0 +1,31 @@
<?php
namespace Opifer\ContentBundle\Block;
/**
* Interface BlockAdapterInterface
*
* Certain clients needs to know if they're working with adapter or
* real block entities.
*
* @package Opifer\ContentBundle\Block
*/
interface BlockAdapterInterface
{
/**
* Return the Doctrine managed entity
*
* @return object
*/
public function getEntity();
/**
* Set the Doctrine managed entity
*
* @param object $entity
*
* @return mixed
*/
public function setEntity($entity);
}
@@ -0,0 +1,42 @@
<?php
namespace Opifer\ContentBundle\Block;
use Opifer\ContentBundle\Model\BlockInterface;
/**
* Interface BlockContainerInterface
*
* @package Opifer\ContentBundle\Block
*/
interface BlockContainerInterface extends BlockInterface
{
/**
* @return ArrayCollection
*/
public function getChildren();
/**
* @param mixed $children
*/
public function setChildren($children);
/**
* Add Block
*
* @param BlockInterface $child
*
* @return BlockInterface
*/
public function addChild(BlockInterface $child);
/**
* Remove Block
*
* @param BlockInterface $child
*
* @return BlockInterface
*/
public function removeChild(BlockInterface $child);
}
Oops, something went wrong.

0 comments on commit ff9dadf

Please sign in to comment.