SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Extending Studio
eZ Conference 2017 | London | 08.06.2017
About Us
Kamil Musiał
PHP Symfony Developer
@kkmusial
Piotr Nalepa
Senior UI Developer
@sunpietro
We are from eZ Systems Polska | Katowice
What is eZ Platform EE?
eZ Platform EE is the extended version
of eZ Platform containing:
• The Studio,
• Flex Workflow,
• Form Builder,
• Date Based Publishing,
• Recommendation Engine.
The Studio - features
Using the Studio you can:
• Preview live website,
• Create landing pages using blocks,
• Manage landing pages,
• Schedule content display,
• Build forms.
The Studio – live website preview
The Studio – landing page management
The Studio – content scheduling
The Studio – Form Builder
eZ Platform EE – features in the Content Editor
• Flex Workflow,
• Date Based Publishing
Content Editor - Flex Workflow
Content Editor - Date Based Publishing
Date Based Publishing – CRON config
Using ezsystems-cron bundle:
date_based_published.cron.publish_scheduled:
class: '%date_based_published.cron.publish_scheduled.class%'
tags:
- { name: console.command }
- { name: ezpublish.cron.job, schedule: '* * * * *' }
Changes publication status based on a publication date in CRON job.
eZ Platform development stack
PHP (Symfony) & JavaScript (YUI3)
So how to extend eZ Platform EE?
Adding new landing page blocks 1/2
To create new blocks you have to:
• Configure blocks definitions by implementing PHP classes,
• Or, use the YAML configuration (the newest thing!).
Create block in PHP - Twig
(ezblock.html.twig)
{{ text_field }}
Create block in PHP - BlockType class
• implements interface:
EzSystemsLandingPageFieldTypeBundleFieldTypeLandingPageM
odelBlockType
or
• extend abstract boilerplate:
EzSystemsLandingPageFieldTypeBundleFieldTypeLandingPageM
odelAbstractBlockType
Create block in PHP - BlockType class
Methods to implement:
• getTemplateParameters(BlockValue $blockValue): array,
• createBlockDefinition(): BlockDefinition,
• checkAttributesStructure(array $attributes)
Create block in PHP - BlockType class
getTemplateParameters(BlockValue $blockValue): array
• contains logic,
• return values for view
Create block in PHP - BlockType class
createBlockDefinition(): BlockDefinition()
Returns a definition containing block parameters and array of its attributes:
EzSystemsLandingPageFieldTypeBundleFieldTypeLandingPageDe
finitionBlockDefinition
Create block in PHP - BlockType class
BlockAttributeDefinition
Block form contains fields based on attribute type.
Available types:
• integer,
• string,
• text,
• embed,
• select (supports multiple select)
Developer can create new attribute types - look at DemoBundle
Create block in PHP - BlockType class
public function createBlockDefinition()
{
return new BlockDefinition(
'ezblock', // Block type (unique)
'eZ Block', // Name of block
'default', // Block category (currently unsupported)
'ezblock.svg', // icon for thumbnail
[], // extra views that can be hardcoded
[
new BlockAttributeDefinition(
'text_field', // Attribute's ID (unique)
'Text field', // Attribute' name
'text', // Attribute's type
'/[^s]/', // regex for frontend validation
'Sample content', // regex validation fail message
true, // is field required?
false, // should this attribute input be displayed inline to the
previous?
[], // default value
[] // available options (for select)
),
]
);
}
Create block in PHP - BlockType class
checkAttributesStructure(array $attributes)
• advanced attribute validation (after front end validation) - 3rd party APIs, DB calls
etc.
• throws exception for invalid attributes:
EzSystemsLandingPageFieldTypeBundleExceptionInvalidBlockAttributeExcep
tion
Create block in YAML - Twig - no changes
(ezblock.html.twig)
{{ text_field }}
Create block in YAML - Config
Extended Simplified
blocks:
ezblock:
initialize: true
name: ezblock
category: default
thumbnail: ezblock.svg
views:
default:
template:
ezblock.html.twig
name: Default view
attributes:
text_field:
name: Text Field
type: text
regex: /.*/
regexErrorMessage: 'error'
blocks:
ezblock:
initialize: true
thumbnail: ezblock.svg
views: ezblock.html.twig
attributes:
text_field: text
Create block in YAML
Form:
Create block in YAML
Rendered block:
Create block in YAML + PHP
initialize: false
class EzBlock extends ConfigurableBlockType
{
public function getTemplateParameters(BlockValue $blockValue)
{
$attributes = $blockValue->getAttributes();
$attributes['text_field'] .= " Additional info";
return $attributes;
}
}
ez_systems.landing_page.block.ez_block:
class:
EzSystemsLandingPageFieldTypeBundleFieldTypeLandingPageModelBlockEzBlock
tags:
- { name: landing_page_field_type.block_type, alias: ezblock }
arguments:
- '@ezpublish.landing_page.block_definition_factory'
Create block in YAML + PHP
Rendered block:
The JS app structure
App
Services +
plugins
Views +
plugins
The communication between JS app layers
• From the bottom to top: addTarget() when creating a new view instance,
• Invoke the fire() method to send an event up to services,
• Using callbacks
Adding new landing page blocks 2/2
To implement custom UI for new blocks you have to (in JavaScript):
• Create a plugin that adds new blocks definitions to landing page creator/editor,
• Create custom views for each new kind of blocks,
• Create custom config popups for each new kind of blocks.
Creating a JS plugin to add new block definition
Y.my.Plugin.AddEzBlockView = Y.Base.create('addEzBlockViewPlugin',
Y.Plugin.Base, [], {
initializer: function () {
this.get('host').addBlock('ezblock', Y.my.EzBlockView);
},
}, {
NS: 'addEzBlockViewPlugin'
});
Y.eZ.PluginRegistry.registerPlugin(Y.my.Plugin.AddEzBlockView, [
'landingPageCreatorView',
'dynamicLandingPageCreatorView',
'dynamicLandingPageEditorView'
]);
Creating a landing page block JS view
Y.my.EzBlockView = Y.Base.create('myEzBlockView', Y.eZS.BlockView, [], {
}, {
ATTRS: {
viewClassName: {
value: 'my.EzBlockView',
readOnly: true
},
editForm: {
valueFn: function () {
return new Y.my.EzBlockConfigFormView({bubbleTargets:
this});
}
}
}
});
Creating a block config popup JS view
Y.my.EzBlockConfigFormView = Y.Base.create('myEzBlockConfigFormView',
Y.eZS.BlockPopupFormView, [], {
anyKindOfMagicMethod: function () {}
});
Adding new fields to Form Builder
To add new fields custom UI to Form Builder you have to (in JavaScript):
• Create a plugin that adds new fields definitions to the Form Builder,
• Create custom views for each new kind of fields,
• Create custom config form for each new kind of fields.
Creating a JS plugin to add new field definition
Y.my.Plugin.AddCustomFieldView =
Y.Base.create('addCustomFieldViewPlugin', Y.Plugin.Base, [], {
initializer: function () {
this.get('host').addFormFieldViewsMapItem('customField',
Y.my.CustomFieldView);
},
}, {
NS: 'addCustomFieldViewPlugin'
});
Y.eZ.PluginRegistry.registerPlugin(Y.my.Plugin.AddCustomFieldView,
['fbFieldsTabView']);
Creating a form builder field JS view
Y.my.CustomFormFieldView = Y.Base.create('customFormFieldView',
Y.fb.BaseFormFieldView, [], {
}, {
ATTRS: {
type: {
value: 'custom'
},
configForm: {
valueFn: function () {
return new Y.my.CustomFormFieldConfigFormView({
bubbleTargets: this,
viewModel: this.get('model')
});
}
},
}
});
Creating a form builder field config form JS view
Y.my.CustomFormFieldConfigFormView =
Y.Base.create('myCustomFormFieldConfigFormView',
Y.fb.FormFieldConfigFormView, [], {
anyKindOfMagicMethod: function () {}
});
eZ Platform EE v2
Additional resources
https://ezplatform.com/Blog/Extending-eZ-Studio-with-new-blocks
https://ezplatform.com/Blog/Learn-how-to-implement-a-custom-UI-for-Landing-Page-block-
configuration-popup
http://yuilibrary.com/yui/docs/api/
Thank you!
Questions?
Contact us on Twitter:
@sunpietro | @kkmusial

Weitere ähnliche Inhalte

Was ist angesagt?

iOS App with Parse.com as RESTful Backend
iOS App with Parse.com as RESTful BackendiOS App with Parse.com as RESTful Backend
iOS App with Parse.com as RESTful Backend
Stefano Zanetti
 
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp MontrealCustom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
Joey Kudish
 
Creating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login SystemCreating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login System
Azharul Haque Shohan
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentation
yamcsha
 

Was ist angesagt? (20)

SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...
SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...
SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...
 
Zk doc1
Zk doc1Zk doc1
Zk doc1
 
web2py:Web development like a boss
web2py:Web development like a bossweb2py:Web development like a boss
web2py:Web development like a boss
 
Sencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
Sencha Roadshow 2017: Modernizing the Ext JS Class System and ToolingSencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
Sencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress Developer
 
Expressjs
ExpressjsExpressjs
Expressjs
 
iOS App with Parse.com as RESTful Backend
iOS App with Parse.com as RESTful BackendiOS App with Parse.com as RESTful Backend
iOS App with Parse.com as RESTful Backend
 
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp MontrealCustom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
 
jQuery Tips Tricks Trivia
jQuery Tips Tricks TriviajQuery Tips Tricks Trivia
jQuery Tips Tricks Trivia
 
Workshop 21: React Router
Workshop 21: React RouterWorkshop 21: React Router
Workshop 21: React Router
 
Utiliser Webpack dans une application Symfony
Utiliser Webpack dans une application SymfonyUtiliser Webpack dans une application Symfony
Utiliser Webpack dans une application Symfony
 
Two scoops of django 1.6 - Ch7, Ch8
Two scoops of django 1.6  - Ch7, Ch8Two scoops of django 1.6  - Ch7, Ch8
Two scoops of django 1.6 - Ch7, Ch8
 
Symfony3 w duecie z Vue.js
Symfony3 w duecie z Vue.jsSymfony3 w duecie z Vue.js
Symfony3 w duecie z Vue.js
 
Express JS
Express JSExpress JS
Express JS
 
Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011
 
DSpace UI Prototype Challenge: Spring Boot + Thymeleaf
DSpace UI Prototype Challenge: Spring Boot + ThymeleafDSpace UI Prototype Challenge: Spring Boot + Thymeleaf
DSpace UI Prototype Challenge: Spring Boot + Thymeleaf
 
Creating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login SystemCreating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login System
 
Geb presentation
Geb presentationGeb presentation
Geb presentation
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentation
 
Banquet 50
Banquet 50Banquet 50
Banquet 50
 

Ähnlich wie Extending Studio

The Basic Concept Of IOC
The Basic Concept Of IOCThe Basic Concept Of IOC
The Basic Concept Of IOC
Carl Lu
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS Basics
Petr Dvorak
 
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
DataLeader.io
 

Ähnlich wie Extending Studio (20)

Extending Studio - Piotr Nalepa & Kamil Musiał - Presentation at eZ Conferenc...
Extending Studio - Piotr Nalepa & Kamil Musiał - Presentation at eZ Conferenc...Extending Studio - Piotr Nalepa & Kamil Musiał - Presentation at eZ Conferenc...
Extending Studio - Piotr Nalepa & Kamil Musiał - Presentation at eZ Conferenc...
 
How to create an Angular builder
How to create an Angular builderHow to create an Angular builder
How to create an Angular builder
 
Custom gutenberg block development in react
Custom gutenberg block development in reactCustom gutenberg block development in react
Custom gutenberg block development in react
 
Web Worker, Service Worker and Worklets
Web Worker, Service Worker and WorkletsWeb Worker, Service Worker and Worklets
Web Worker, Service Worker and Worklets
 
Introducing coServ
Introducing coServIntroducing coServ
Introducing coServ
 
Liferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for DevelopersLiferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for Developers
 
Building Dojo in the Cloud
Building Dojo in the CloudBuilding Dojo in the Cloud
Building Dojo in the Cloud
 
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
ZZ BC#7.5 asp.net mvc practice  and guideline refresh! ZZ BC#7.5 asp.net mvc practice  and guideline refresh!
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
 
What's New in Visual Studio 2008
What's New in Visual Studio 2008What's New in Visual Studio 2008
What's New in Visual Studio 2008
 
React Basic and Advance || React Basic
React Basic and Advance   || React BasicReact Basic and Advance   || React Basic
React Basic and Advance || React Basic
 
Custom gutenberg block development with React
Custom gutenberg block development with ReactCustom gutenberg block development with React
Custom gutenberg block development with React
 
Front End Development: The Important Parts
Front End Development: The Important PartsFront End Development: The Important Parts
Front End Development: The Important Parts
 
The Basic Concept Of IOC
The Basic Concept Of IOCThe Basic Concept Of IOC
The Basic Concept Of IOC
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS Basics
 
Bootstrap and XPages (DanNotes 2013)
Bootstrap and XPages (DanNotes 2013)Bootstrap and XPages (DanNotes 2013)
Bootstrap and XPages (DanNotes 2013)
 
Social Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes DemystifiedSocial Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes Demystified
 
Intorduction of Playframework
Intorduction of PlayframeworkIntorduction of Playframework
Intorduction of Playframework
 
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
 

Mehr von Piotr Nalepa

Semantyka w tworzeniu stron www prezentacja
Semantyka w tworzeniu stron www   prezentacjaSemantyka w tworzeniu stron www   prezentacja
Semantyka w tworzeniu stron www prezentacja
Piotr Nalepa
 

Mehr von Piotr Nalepa (6)

Building Framework Agnostic UI with Web Components
Building Framework Agnostic UI with Web ComponentsBuilding Framework Agnostic UI with Web Components
Building Framework Agnostic UI with Web Components
 
JAK TESTOWAĆ CZYSTY KOD JAVASCRIPT?
JAK TESTOWAĆ CZYSTY KOD JAVASCRIPT?JAK TESTOWAĆ CZYSTY KOD JAVASCRIPT?
JAK TESTOWAĆ CZYSTY KOD JAVASCRIPT?
 
Developing native-like Windows application using JavaScript, SSE, eZ Platform...
Developing native-like Windows application using JavaScript, SSE, eZ Platform...Developing native-like Windows application using JavaScript, SSE, eZ Platform...
Developing native-like Windows application using JavaScript, SSE, eZ Platform...
 
Perfomance w Joomla - Jak przyspieszyć działanie strony?
Perfomance w Joomla - Jak przyspieszyć działanie strony?Perfomance w Joomla - Jak przyspieszyć działanie strony?
Perfomance w Joomla - Jak przyspieszyć działanie strony?
 
ZOSTAŃ NINJA JOOMLA! DEVELOPEREM Automatyzacja zadań w procesie tworzenia sza...
ZOSTAŃ NINJA JOOMLA! DEVELOPEREM Automatyzacja zadań w procesie tworzenia sza...ZOSTAŃ NINJA JOOMLA! DEVELOPEREM Automatyzacja zadań w procesie tworzenia sza...
ZOSTAŃ NINJA JOOMLA! DEVELOPEREM Automatyzacja zadań w procesie tworzenia sza...
 
Semantyka w tworzeniu stron www prezentacja
Semantyka w tworzeniu stron www   prezentacjaSemantyka w tworzeniu stron www   prezentacja
Semantyka w tworzeniu stron www prezentacja
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Extending Studio

  • 1. Extending Studio eZ Conference 2017 | London | 08.06.2017
  • 2. About Us Kamil Musiał PHP Symfony Developer @kkmusial Piotr Nalepa Senior UI Developer @sunpietro
  • 3. We are from eZ Systems Polska | Katowice
  • 4. What is eZ Platform EE? eZ Platform EE is the extended version of eZ Platform containing: • The Studio, • Flex Workflow, • Form Builder, • Date Based Publishing, • Recommendation Engine.
  • 5. The Studio - features Using the Studio you can: • Preview live website, • Create landing pages using blocks, • Manage landing pages, • Schedule content display, • Build forms.
  • 6. The Studio – live website preview
  • 7. The Studio – landing page management
  • 8. The Studio – content scheduling
  • 9. The Studio – Form Builder
  • 10. eZ Platform EE – features in the Content Editor • Flex Workflow, • Date Based Publishing
  • 11. Content Editor - Flex Workflow
  • 12. Content Editor - Date Based Publishing
  • 13. Date Based Publishing – CRON config Using ezsystems-cron bundle: date_based_published.cron.publish_scheduled: class: '%date_based_published.cron.publish_scheduled.class%' tags: - { name: console.command } - { name: ezpublish.cron.job, schedule: '* * * * *' } Changes publication status based on a publication date in CRON job.
  • 14. eZ Platform development stack PHP (Symfony) & JavaScript (YUI3)
  • 15. So how to extend eZ Platform EE?
  • 16. Adding new landing page blocks 1/2 To create new blocks you have to: • Configure blocks definitions by implementing PHP classes, • Or, use the YAML configuration (the newest thing!).
  • 17. Create block in PHP - Twig (ezblock.html.twig) {{ text_field }}
  • 18. Create block in PHP - BlockType class • implements interface: EzSystemsLandingPageFieldTypeBundleFieldTypeLandingPageM odelBlockType or • extend abstract boilerplate: EzSystemsLandingPageFieldTypeBundleFieldTypeLandingPageM odelAbstractBlockType
  • 19. Create block in PHP - BlockType class Methods to implement: • getTemplateParameters(BlockValue $blockValue): array, • createBlockDefinition(): BlockDefinition, • checkAttributesStructure(array $attributes)
  • 20. Create block in PHP - BlockType class getTemplateParameters(BlockValue $blockValue): array • contains logic, • return values for view
  • 21. Create block in PHP - BlockType class createBlockDefinition(): BlockDefinition() Returns a definition containing block parameters and array of its attributes: EzSystemsLandingPageFieldTypeBundleFieldTypeLandingPageDe finitionBlockDefinition
  • 22. Create block in PHP - BlockType class BlockAttributeDefinition Block form contains fields based on attribute type. Available types: • integer, • string, • text, • embed, • select (supports multiple select) Developer can create new attribute types - look at DemoBundle
  • 23. Create block in PHP - BlockType class public function createBlockDefinition() { return new BlockDefinition( 'ezblock', // Block type (unique) 'eZ Block', // Name of block 'default', // Block category (currently unsupported) 'ezblock.svg', // icon for thumbnail [], // extra views that can be hardcoded [ new BlockAttributeDefinition( 'text_field', // Attribute's ID (unique) 'Text field', // Attribute' name 'text', // Attribute's type '/[^s]/', // regex for frontend validation 'Sample content', // regex validation fail message true, // is field required? false, // should this attribute input be displayed inline to the previous? [], // default value [] // available options (for select) ), ] ); }
  • 24. Create block in PHP - BlockType class checkAttributesStructure(array $attributes) • advanced attribute validation (after front end validation) - 3rd party APIs, DB calls etc. • throws exception for invalid attributes: EzSystemsLandingPageFieldTypeBundleExceptionInvalidBlockAttributeExcep tion
  • 25. Create block in YAML - Twig - no changes (ezblock.html.twig) {{ text_field }}
  • 26. Create block in YAML - Config Extended Simplified blocks: ezblock: initialize: true name: ezblock category: default thumbnail: ezblock.svg views: default: template: ezblock.html.twig name: Default view attributes: text_field: name: Text Field type: text regex: /.*/ regexErrorMessage: 'error' blocks: ezblock: initialize: true thumbnail: ezblock.svg views: ezblock.html.twig attributes: text_field: text
  • 27. Create block in YAML Form:
  • 28. Create block in YAML Rendered block:
  • 29. Create block in YAML + PHP initialize: false class EzBlock extends ConfigurableBlockType { public function getTemplateParameters(BlockValue $blockValue) { $attributes = $blockValue->getAttributes(); $attributes['text_field'] .= " Additional info"; return $attributes; } } ez_systems.landing_page.block.ez_block: class: EzSystemsLandingPageFieldTypeBundleFieldTypeLandingPageModelBlockEzBlock tags: - { name: landing_page_field_type.block_type, alias: ezblock } arguments: - '@ezpublish.landing_page.block_definition_factory'
  • 30. Create block in YAML + PHP Rendered block:
  • 31. The JS app structure App Services + plugins Views + plugins
  • 32. The communication between JS app layers • From the bottom to top: addTarget() when creating a new view instance, • Invoke the fire() method to send an event up to services, • Using callbacks
  • 33. Adding new landing page blocks 2/2 To implement custom UI for new blocks you have to (in JavaScript): • Create a plugin that adds new blocks definitions to landing page creator/editor, • Create custom views for each new kind of blocks, • Create custom config popups for each new kind of blocks.
  • 34. Creating a JS plugin to add new block definition Y.my.Plugin.AddEzBlockView = Y.Base.create('addEzBlockViewPlugin', Y.Plugin.Base, [], { initializer: function () { this.get('host').addBlock('ezblock', Y.my.EzBlockView); }, }, { NS: 'addEzBlockViewPlugin' }); Y.eZ.PluginRegistry.registerPlugin(Y.my.Plugin.AddEzBlockView, [ 'landingPageCreatorView', 'dynamicLandingPageCreatorView', 'dynamicLandingPageEditorView' ]);
  • 35. Creating a landing page block JS view Y.my.EzBlockView = Y.Base.create('myEzBlockView', Y.eZS.BlockView, [], { }, { ATTRS: { viewClassName: { value: 'my.EzBlockView', readOnly: true }, editForm: { valueFn: function () { return new Y.my.EzBlockConfigFormView({bubbleTargets: this}); } } } });
  • 36. Creating a block config popup JS view Y.my.EzBlockConfigFormView = Y.Base.create('myEzBlockConfigFormView', Y.eZS.BlockPopupFormView, [], { anyKindOfMagicMethod: function () {} });
  • 37. Adding new fields to Form Builder To add new fields custom UI to Form Builder you have to (in JavaScript): • Create a plugin that adds new fields definitions to the Form Builder, • Create custom views for each new kind of fields, • Create custom config form for each new kind of fields.
  • 38. Creating a JS plugin to add new field definition Y.my.Plugin.AddCustomFieldView = Y.Base.create('addCustomFieldViewPlugin', Y.Plugin.Base, [], { initializer: function () { this.get('host').addFormFieldViewsMapItem('customField', Y.my.CustomFieldView); }, }, { NS: 'addCustomFieldViewPlugin' }); Y.eZ.PluginRegistry.registerPlugin(Y.my.Plugin.AddCustomFieldView, ['fbFieldsTabView']);
  • 39. Creating a form builder field JS view Y.my.CustomFormFieldView = Y.Base.create('customFormFieldView', Y.fb.BaseFormFieldView, [], { }, { ATTRS: { type: { value: 'custom' }, configForm: { valueFn: function () { return new Y.my.CustomFormFieldConfigFormView({ bubbleTargets: this, viewModel: this.get('model') }); } }, } });
  • 40. Creating a form builder field config form JS view Y.my.CustomFormFieldConfigFormView = Y.Base.create('myCustomFormFieldConfigFormView', Y.fb.FormFieldConfigFormView, [], { anyKindOfMagicMethod: function () {} });
  • 43. Thank you! Questions? Contact us on Twitter: @sunpietro | @kkmusial