Extending Apostrophe to build a variable-based CMS for rendering PDF brochuresSpike BrehmFront-end Engineer @ SunRun, Inc.
About MeSymfony developer since 2009@spikebrehmAbout SunRunThe nation’s largest provider of Solar Power Service – think SaaSComplex business model and fragmented marketsAble to scale quickly because of software tools
The Problem25 Partners13 Markets24 UtilitiesRetail vs. direct saleMaintaining Sales DocumentsCustom document for each combination (25 * 13 * … )Flat PHP files, edited by handSymlinks on the filesystem to approximate reuse
The Proposed Solution“Let’s build a CMS so that our Sales team can maintain these documents and Engineering can focus on building more cool tools!”
Introducing: FlapjackCMS for maintaining complex sales documentssymfony 1.4Doctrine 1.xapostrophePlugin 1.4apostropheBlogPlugin 1.4
Introducing: Flapjack
Why Apostrophe?ExperienceBuilt our corporate website on ApostropheLearned how to extend it at the app levelDon’t reinvent the wheelRich text editortemplatesFramework for building custom slots (widgets)
The Data ModelDocumentsPagesBlocksWidgetsVariablesVisibility filters… srDocument… srPage -> aPage… aBlogItem… aSlot… srParsedVariable(not Doctrine)… srVisibilityFilterSchema… srVisibilityFilter… srVisibilityExpressionSchema… srVisibilityExpressionGroup… srVisibilityExpression… srVisibilityConsequent
Pages to DocumentsWhy create srPage instead of extending aPage?
Slots to Pages: originalaPage can be both concrete and virtual.Notice circular relationships.
Slots to Pages: FlapjackInstead of associating aBlogItem to aSlot using the aSlot.value field, we use a join objectsrBlogItemBlockSlot for many-to-many.Note: simplified visibility filter schema.
Extending ApostropheCustom Slots
Custom Slots
Custom SlotssrStepListSlot: options:symfony: form: false filter: false inheritance: extends: aSlot type: column_aggregationkeyField: typekeyValue: 'srStepList'./symfonyapostrophe:generate-slot-type --application=frontend --type=srStepList? apps/frontend/lib/form/srStepListSlotEditForm.class.php? apps/frontend/modules/srStepListSlot/actions/actions.class.php? apps/frontend/modules/srStepListSlot/actions/components.class.php? apps/frontend/modules/srStepListSlot/templates/_normalView.php? apps/frontend/modules/srStepListSlot/templates/_editView.phpM config/doctrine/schema.yml./symfonydoctrine:build --all-classes? lib/model/doctrine/srStepListSlot.class.php? lib/model/doctrine/srStepListSlotTable.class.php? lib/model/doctrine/base/BasesrStepListSlot.class.phpM lib/model/doctrine/apostrophePlugin/base/BaseaSlot.class.php
_normalView.php
_editView.php
srStepListSlotEditForm.class.php
components.class.php
getArrayValueParsed()???
aSlot.class.php
Variables: edit mode
Variables: preview mode

Extending Apostrophe to build a variable-based CMS for rendering PDF brochures

  • 1.
    Extending Apostrophe tobuild a variable-based CMS for rendering PDF brochuresSpike BrehmFront-end Engineer @ SunRun, Inc.
  • 2.
    About MeSymfony developersince 2009@spikebrehmAbout SunRunThe nation’s largest provider of Solar Power Service – think SaaSComplex business model and fragmented marketsAble to scale quickly because of software tools
  • 3.
    The Problem25 Partners13Markets24 UtilitiesRetail vs. direct saleMaintaining Sales DocumentsCustom document for each combination (25 * 13 * … )Flat PHP files, edited by handSymlinks on the filesystem to approximate reuse
  • 4.
    The Proposed Solution“Let’sbuild a CMS so that our Sales team can maintain these documents and Engineering can focus on building more cool tools!”
  • 5.
    Introducing: FlapjackCMS formaintaining complex sales documentssymfony 1.4Doctrine 1.xapostrophePlugin 1.4apostropheBlogPlugin 1.4
  • 6.
  • 7.
    Why Apostrophe?ExperienceBuilt ourcorporate website on ApostropheLearned how to extend it at the app levelDon’t reinvent the wheelRich text editortemplatesFramework for building custom slots (widgets)
  • 8.
    The Data ModelDocumentsPagesBlocksWidgetsVariablesVisibilityfilters… srDocument… srPage -> aPage… aBlogItem… aSlot… srParsedVariable(not Doctrine)… srVisibilityFilterSchema… srVisibilityFilter… srVisibilityExpressionSchema… srVisibilityExpressionGroup… srVisibilityExpression… srVisibilityConsequent
  • 9.
    Pages to DocumentsWhycreate srPage instead of extending aPage?
  • 10.
    Slots to Pages:originalaPage can be both concrete and virtual.Notice circular relationships.
  • 11.
    Slots to Pages:FlapjackInstead of associating aBlogItem to aSlot using the aSlot.value field, we use a join objectsrBlogItemBlockSlot for many-to-many.Note: simplified visibility filter schema.
  • 12.
  • 13.
  • 14.
    Custom SlotssrStepListSlot: options:symfony: form: false filter: false inheritance: extends: aSlot type: column_aggregationkeyField: typekeyValue: 'srStepList'./symfonyapostrophe:generate-slot-type --application=frontend --type=srStepList? apps/frontend/lib/form/srStepListSlotEditForm.class.php? apps/frontend/modules/srStepListSlot/actions/actions.class.php? apps/frontend/modules/srStepListSlot/actions/components.class.php? apps/frontend/modules/srStepListSlot/templates/_normalView.php? apps/frontend/modules/srStepListSlot/templates/_editView.phpM config/doctrine/schema.yml./symfonydoctrine:build --all-classes? lib/model/doctrine/srStepListSlot.class.php? lib/model/doctrine/srStepListSlotTable.class.php? lib/model/doctrine/base/BasesrStepListSlot.class.phpM lib/model/doctrine/apostrophePlugin/base/BaseaSlot.class.php
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.

Editor's Notes

  • #7 How many of you have used Apostrophe? How does this look different from a typical Apostrophe site?