SlideShare a Scribd company logo
1 of 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

More Related Content

What's hot

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
 

What's hot (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
 

Similar to 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
 

Similar to 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...
 

More from 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
 

More from 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
 

Recently uploaded

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
UK Journal
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 

Recently uploaded (20)

Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4j
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 

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