SlideShare a Scribd company logo
Howto Hyvä
 
Compatibility Modules!
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
How to make extensions that
were built for Luma
compatible with Hyvä...
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Compatibility Modules
Replace Luma code with Hyvä compatible templates:
From ! To "
# .phtml # .phtml
$ .less # .phtml
% .js # .phtml
& .html # .phtml
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Compatibility Modules
From ! To .phtml "
# .phtml ✨ HTML5
% .less Tailwind CSS ✨
& .js ✨ vanilla + Alpine.js
' .html HTML5 + Alpine.js ✨
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
Need to use a
module?
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Need to use a module?
 
First
Check the compat module tracker
— If it already is compatible:
— If not, open an issue in the tracker:
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Need to use a module?
 
Second
Request a skeleton compat module
In Slack, request a skeleton compat module, with both
— the original module Magento_Name
— the original module composer package/name
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
What does a skeleton repo contain?
.
├── LICENSE.md
├── README.md
├── composer.json
└── src
├── etc
│   ├── frontend
│   │   └── di.xml
│   └── module.xml
└── registration.php
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
$ cat composer.json
{
"name": "hyva-themes/magento2-orig-module",
"description": "Hyvä Themes Compatibility module for Orig_Module",
"type": "magento2-module",
"require": {
"magento/framework": "*",
"hyva-themes/magento2-compat-module-fallback": "*",
"orig/module": "*"
}
...
}
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
$ cat src/etc/frontend/di.xml
<config>
<type name="HyvaCompatModuleFallbackModelCompatModuleRegistry">
<arguments>
<argument name="compatModules" xsi:type="array">
<item name="hyva-magento2-orig-module" xsi:type="array">
<item name="original_module" xsi:type="string">Orig_Module</item>
<item name="compat_module" xsi:type="string">Hyva_OrigModule</item>
</item>
</argument>
</arguments>
</type>
</config>
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
The CompatModuleRegistry
  
What is it good for?
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
Automatic
Template Overrides
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Automatic Template Overrides
— Original module
Smile_ElasticsuiteCatalog
view/frontend/templates/layer/view.phtml
— Two alternative override options in
Hyva_SmileElasticsuiteCatalog:
view/frontend/templates/layer/view.phtml
view/frontend/templates/Smile_ElasticsuiteCatalog/layer/view.phtml
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
Other tools
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Luma Reference Store View
!
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Hyvä Prefix Layout Updates
Luma:
default.xml
customer_address_edit.xml
customer_account.xml
Hyvä:
default.xml
hyva_default.xml
customer_address_edit.xml
hyva_customer_address_edit.xml
customer_account.xml
hyva_customer_account.xml
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Is this Hyvä?
In Observers / Plugins:
Does the requested store view have a Hyvä theme?
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Is this Hyvä?
public function __construct(
HyvaThemeServiceCurrentTheme $currentTheme
) {
$this->currentTheme = $currentTheme;
}
public function execute(Event $event) {
if (!$this->currentTheme->isHyva()) {
return;
}
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
First steps
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Step by Step
1. Copy offending template into compat module
2. Rewrite JavaScript
3. Rewrite Styles
4. Repeat
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
Rewrite JavaScript
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Rewrite Luma JavaScript to
1. Vanilla JS
2. Alpine JS
3. External JS Libraries
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Vanilla JS
<script>
function ebizmartsMailChimpCampaignCatcher() {
// ...
}
window.addEventListener('DOMContentLoaded', ebizmartsMailChimpCampaignCatcher);
</script>
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Alpine JS
<script>
function initCheckoutGiftCards() {
return {
receiveSectionData(data) { ... },
toggleGiftcardForm() { ... },
}
}
</script>
<div x-data="initCheckoutGiftCards()"
@private-content-loaded.window="receiveSectionData($event.detail.data)">
<div @click="toggleGiftcardForm"
@keydown.enter="toggleGiftcardForm">
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
External JS Library
<div id="fake-widget-placeholder">
...
</div>
<script>
(function() {
function init() {
const script = document.createElement('script')
script.src = '<?= $escaper->escapeUrl($block->getViewFileUrl('My_Module/js/my-library.js')) ?>';
// The function initLibrary would be provided by the external JS
script.addEventListener('load', () => initLibrary('fake-widget-placeholder'));
document.head.append(script);
}
document.body.addEventListener('touchstart', init, {once: true});
document.body.addEventListener('mouseover', init, {once: true});
})();
</script>
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
jQuery ➡ Vanilla JS
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
jQuery ➡ Vanilla JS
jQuery
$('#product-addtocart-button')
.click(function(e) {
e.preventDefault();
// some custom check
// if ok
$('#product_addtocart_form')
.submit();
});
Vanilla
document
.getElementById('product-addtocart-button')
.addEventListener('click', (e) => {
e.preventDefault();
// some custom check
// if ok
document
.getElementById('product_addtocart_form')
.submit();
})
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
jQuery ➡ Vanilla JS
https://youMightNotNeedjQuery.com/
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Ajax / GraphQL ➡ fetch()
fetch(
url + '?form_key=' + hyva.getFormKey(),
{
method: 'post',
body: JSON.stringify(data),
headers: {contentType: 'application/json'}
}
)
.then(response => response.json())
.then(result => {
// ...
})
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
window.hyva
— hyva.getCookie(name)
— hyva.setCookie(name, value, days, skipSetDomain)
— hyva.getBrowserStorage()
— hyva.postForm(postParams)
— hyva.getFormKey()
— hyva.formatPrice(value, showSign)
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Customer Section Data
<div x-data="" @private-content-loaded.window="console.log($event.detail.data)"></div>
{
messages: {...},
customer: {...},
compare-products: {...},
last-ordered-items: {...},
cart: {...},
directory-data: {...},
instant-purchase: {...},
loggedAsCustomer: {...},
captcha: {...},
persistent: {...},
review: {...},
wishlist: {...},
recently_viewed_product: {...},
recently_compared_product: {...},
product_data_storage: {...},
paypal-billing-agreement': {...}
}
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Reload Customer Section Data
no automatic invalidation
window.dispatchEvent(
new CustomEvent("reload-customer-section-data")
);
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
Rewrite Styles
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Replace Luma styles
Luma
<ul class="compare wrapper">
<li class="item link compare">
<a class="action compare no-display" title="Compare products"
Hyvä
<div class="flex items-center order-3">
<a id="compare-link"
class="relative invisible inline-block mx-1 no-underline sm:ml-3 hover:text-black"
title="Compare Products"
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Remove additional .less styles
➡ replace with inline Tailwind CSS classes
<!-- Remove in compat module layout XML -->
<remove src="Magezon_Core::css/styles.css"/>
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
 
External non-Luma CSS
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
External non-Luma CSS
Used in Critical Rendering Path?
<remove src="Amasty_ShopbyBase::css/swiper.min.css"/>
➡ replace with inline Tailwind CSS classes
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
External non-Luma CSS
Not part of Critical Rendering Path?
document.addEventListener('DOMContentLoaded', function () {
function init() {
const link = document.createElement('link')
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '<?= $escaper->escapeUrl($block->getViewFileUrl('Ho_Templatehints::css/hints.css')) ?>';
document.head.append(link);
}
document.body.addEventListener('touchstart', init, {once: true});
document.body.addEventListener('mouseover', init, {once: true});
}, {once: true});
➡ keep & load when needed
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
[Commercial] Windy Browser Plugin
Automatically convert styles to Tailwind CSS!
https://usewindy.com/
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
PHP View Models
Modern View Helpers
/** @var HyvaThemeModelViewModelRegistry $viewModels */
$currentProduct = $viewModels->require(
HyvaThemeViewModelCurrentProduct::class
);
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
PHP View Models
<?php
$modal = $viewModels->require(HyvaThemeViewModelModal::class)
->createModal()
->withTemplate('My_Module::my-dialog-content.phtml')
->withAriaLabel('Example modal with content template');
?>
<div x-data="hyva.modal()">
<button @click="show" type="button" class="btn">
<?= $escaper->escapeHtml(__('Show Modal')) ?>
</button>
<?= $modal ?>
</div>
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
Enjoy & Thanks!
https://hyva.io
@hyva_io
@VinaiKopp
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io

More Related Content

What's hot

Maven et industrialisation du logiciel
Maven et industrialisation du logicielMaven et industrialisation du logiciel
Maven et industrialisation du logiciel
ENSET, Université Hassan II Casablanca
 
Module 1 introduction au développement web avec visual studio 2012
Module 1   introduction au développement web avec visual studio 2012Module 1   introduction au développement web avec visual studio 2012
Module 1 introduction au développement web avec visual studio 2012
Mohammed Amine Mostefai
 
Node js
Node jsNode js
SK Telecom TACO Introduction at Berlin Summit
SK Telecom TACO Introduction at Berlin SummitSK Telecom TACO Introduction at Berlin Summit
SK Telecom TACO Introduction at Berlin Summit
Jaesuk Ahn
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
viniciusban
 
Formation autour de git et git lab
Formation autour de git et git labFormation autour de git et git lab
Formation autour de git et git lab
Abdelghani Azri
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
Javier Lafora Rey
 
ReactJS vs Vue.js — What to choose in 2019?
ReactJS vs Vue.js — What to choose in 2019?ReactJS vs Vue.js — What to choose in 2019?
ReactJS vs Vue.js — What to choose in 2019?
Pixel Crayons
 
React Native
React NativeReact Native
React Native
Fatih Şimşek
 
Svelte the future of frontend development
Svelte   the future of frontend developmentSvelte   the future of frontend development
Svelte the future of frontend development
twilson63
 
Git and GitFlow branching model
Git and GitFlow branching modelGit and GitFlow branching model
Git and GitFlow branching model
Pavlo Hodysh
 
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Matt Raible
 
A Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyA Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching Strategy
Vivek Parihar
 
Deleting a Node from a Binary Search Tree (Scheme
Deleting a Node from a Binary Search Tree (SchemeDeleting a Node from a Binary Search Tree (Scheme
Deleting a Node from a Binary Search Tree (Scheme
adcaine
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
Gaurav Wable
 
Microservices With Node.js
Microservices With Node.jsMicroservices With Node.js
Microservices With Node.js
Jonathan Martin Brizio
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLab
Shinu Suresh
 
Github basics
Github basicsGithub basics
Github basics
Radoslav Georgiev
 
Automating "Network Ready for Use" with pytest
Automating "Network Ready for Use" with pytestAutomating "Network Ready for Use" with pytest
Automating "Network Ready for Use" with pytest
Jeremy Schulman
 

What's hot (20)

Maven et industrialisation du logiciel
Maven et industrialisation du logicielMaven et industrialisation du logiciel
Maven et industrialisation du logiciel
 
Module 1 introduction au développement web avec visual studio 2012
Module 1   introduction au développement web avec visual studio 2012Module 1   introduction au développement web avec visual studio 2012
Module 1 introduction au développement web avec visual studio 2012
 
Node js
Node jsNode js
Node js
 
SK Telecom TACO Introduction at Berlin Summit
SK Telecom TACO Introduction at Berlin SummitSK Telecom TACO Introduction at Berlin Summit
SK Telecom TACO Introduction at Berlin Summit
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
 
Formation autour de git et git lab
Formation autour de git et git labFormation autour de git et git lab
Formation autour de git et git lab
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
 
ReactJS vs Vue.js — What to choose in 2019?
ReactJS vs Vue.js — What to choose in 2019?ReactJS vs Vue.js — What to choose in 2019?
ReactJS vs Vue.js — What to choose in 2019?
 
React Native
React NativeReact Native
React Native
 
Svelte the future of frontend development
Svelte   the future of frontend developmentSvelte   the future of frontend development
Svelte the future of frontend development
 
Git and GitFlow branching model
Git and GitFlow branching modelGit and GitFlow branching model
Git and GitFlow branching model
 
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
 
A Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyA Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching Strategy
 
Deleting a Node from a Binary Search Tree (Scheme
Deleting a Node from a Binary Search Tree (SchemeDeleting a Node from a Binary Search Tree (Scheme
Deleting a Node from a Binary Search Tree (Scheme
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Microservices With Node.js
Microservices With Node.jsMicroservices With Node.js
Microservices With Node.js
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLab
 
Github basics
Github basicsGithub basics
Github basics
 
Automating "Network Ready for Use" with pytest
Automating "Network Ready for Use" with pytestAutomating "Network Ready for Use" with pytest
Automating "Network Ready for Use" with pytest
 

Similar to Hyvä: Compatibility Modules

Vue micro frontend implementation patterns
Vue micro frontend implementation patternsVue micro frontend implementation patterns
Vue micro frontend implementation patterns
Albert Brand
 
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
Magecom UK Limited
 
One year of Sitecore XC9 in retrospect
One year of Sitecore XC9 in retrospectOne year of Sitecore XC9 in retrospect
One year of Sitecore XC9 in retrospect
Jonne Kats
 
Js foo - Sept 8 upload
Js foo - Sept 8 uploadJs foo - Sept 8 upload
Js foo - Sept 8 upload
Debnath Sinha
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento
Ravi Mehrotra
 
Mangento
MangentoMangento
Mangento
Ravi Mehrotra
 
Magento
MagentoMagento
Search engine optimization for symfony developers
Search engine optimization for symfony developersSearch engine optimization for symfony developers
Search engine optimization for symfony developers
Maximilian Berghoff
 
Yoav Kutner Dutchento
Yoav Kutner DutchentoYoav Kutner Dutchento
Yoav Kutner Dutchento
Guido X Jansen
 
Building Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSBuilding Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJS
Antonio Peric-Mazar
 
Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)
Spike Brehm
 
Get your mobile app in production in 3 months: Native and Reactive Mobile Apps
Get your mobile app in production in 3 months: Native and Reactive Mobile AppsGet your mobile app in production in 3 months: Native and Reactive Mobile Apps
Get your mobile app in production in 3 months: Native and Reactive Mobile Apps
Ackee
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
Matt Raible
 
Magento 2 development
Magento 2 developmentMagento 2 development
Magento 2 development
Olivia Williams
 
Magento vs big commerce a detailed comparison guide - ziffity
Magento vs big commerce  a detailed comparison guide - ziffityMagento vs big commerce  a detailed comparison guide - ziffity
Magento vs big commerce a detailed comparison guide - ziffity
Ziffity Solutions LLC
 
EECI - EE And Magento Integration
EECI - EE And Magento IntegrationEECI - EE And Magento Integration
EECI - EE And Magento IntegrationSimplified Safety
 
API Design Best Practices by Igor Miniailo
API Design Best Practices by Igor MiniailoAPI Design Best Practices by Igor Miniailo
API Design Best Practices by Igor Miniailo
Magecom UK Limited
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
Antônio Roberto Silva
 
How to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring EditionHow to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring EditionStephan Hochdörfer
 
Planbox Backbone MVC
Planbox Backbone MVCPlanbox Backbone MVC
Planbox Backbone MVC
Acquisio
 

Similar to Hyvä: Compatibility Modules (20)

Vue micro frontend implementation patterns
Vue micro frontend implementation patternsVue micro frontend implementation patterns
Vue micro frontend implementation patterns
 
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
 
One year of Sitecore XC9 in retrospect
One year of Sitecore XC9 in retrospectOne year of Sitecore XC9 in retrospect
One year of Sitecore XC9 in retrospect
 
Js foo - Sept 8 upload
Js foo - Sept 8 uploadJs foo - Sept 8 upload
Js foo - Sept 8 upload
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento
 
Mangento
MangentoMangento
Mangento
 
Magento
MagentoMagento
Magento
 
Search engine optimization for symfony developers
Search engine optimization for symfony developersSearch engine optimization for symfony developers
Search engine optimization for symfony developers
 
Yoav Kutner Dutchento
Yoav Kutner DutchentoYoav Kutner Dutchento
Yoav Kutner Dutchento
 
Building Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSBuilding Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJS
 
Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)
 
Get your mobile app in production in 3 months: Native and Reactive Mobile Apps
Get your mobile app in production in 3 months: Native and Reactive Mobile AppsGet your mobile app in production in 3 months: Native and Reactive Mobile Apps
Get your mobile app in production in 3 months: Native and Reactive Mobile Apps
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
 
Magento 2 development
Magento 2 developmentMagento 2 development
Magento 2 development
 
Magento vs big commerce a detailed comparison guide - ziffity
Magento vs big commerce  a detailed comparison guide - ziffityMagento vs big commerce  a detailed comparison guide - ziffity
Magento vs big commerce a detailed comparison guide - ziffity
 
EECI - EE And Magento Integration
EECI - EE And Magento IntegrationEECI - EE And Magento Integration
EECI - EE And Magento Integration
 
API Design Best Practices by Igor Miniailo
API Design Best Practices by Igor MiniailoAPI Design Best Practices by Igor Miniailo
API Design Best Practices by Igor Miniailo
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
How to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring EditionHow to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring Edition
 
Planbox Backbone MVC
Planbox Backbone MVCPlanbox Backbone MVC
Planbox Backbone MVC
 

More from vinaikopp

Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023
vinaikopp
 
Property Based Testing in PHP
Property Based Testing in PHPProperty Based Testing in PHP
Property Based Testing in PHP
vinaikopp
 
Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019
vinaikopp
 
Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018
vinaikopp
 
SOS UiComponents
SOS UiComponentsSOS UiComponents
SOS UiComponents
vinaikopp
 
ClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRNClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRN
vinaikopp
 
Magento 2 TDD Code Kata
Magento 2 TDD Code KataMagento 2 TDD Code Kata
Magento 2 TDD Code Kata
vinaikopp
 
Magento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata IntroMagento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata Intro
vinaikopp
 
Testing Magento 2
Testing Magento 2Testing Magento 2
Testing Magento 2
vinaikopp
 
ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017
vinaikopp
 
Lizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17deLizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17de
vinaikopp
 
Stories from the other side
Stories from the other sideStories from the other side
Stories from the other side
vinaikopp
 
Writing Testable Code (for Magento 1 and 2) 2016 Romaina
Writing Testable Code (for Magento 1 and 2)  2016 RomainaWriting Testable Code (for Magento 1 and 2)  2016 Romaina
Writing Testable Code (for Magento 1 and 2) 2016 Romaina
vinaikopp
 
Writing Testable Code (for Magento 1 and 2)
Writing Testable Code (for Magento 1 and 2)Writing Testable Code (for Magento 1 and 2)
Writing Testable Code (for Magento 1 and 2)
vinaikopp
 
Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)
vinaikopp
 
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
vinaikopp
 
Getting your hands dirty testing Magento 2 (at MageTitansIT)
Getting your hands dirty testing Magento 2 (at MageTitansIT)Getting your hands dirty testing Magento 2 (at MageTitansIT)
Getting your hands dirty testing Magento 2 (at MageTitansIT)
vinaikopp
 
Architecture in-the-small-slides
Architecture in-the-small-slidesArchitecture in-the-small-slides
Architecture in-the-small-slides
vinaikopp
 
Modern Module Architecture
Modern Module ArchitectureModern Module Architecture
Modern Module Architecture
vinaikopp
 
The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014
vinaikopp
 

More from vinaikopp (20)

Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023
 
Property Based Testing in PHP
Property Based Testing in PHPProperty Based Testing in PHP
Property Based Testing in PHP
 
Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019
 
Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018
 
SOS UiComponents
SOS UiComponentsSOS UiComponents
SOS UiComponents
 
ClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRNClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRN
 
Magento 2 TDD Code Kata
Magento 2 TDD Code KataMagento 2 TDD Code Kata
Magento 2 TDD Code Kata
 
Magento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata IntroMagento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata Intro
 
Testing Magento 2
Testing Magento 2Testing Magento 2
Testing Magento 2
 
ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017
 
Lizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17deLizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17de
 
Stories from the other side
Stories from the other sideStories from the other side
Stories from the other side
 
Writing Testable Code (for Magento 1 and 2) 2016 Romaina
Writing Testable Code (for Magento 1 and 2)  2016 RomainaWriting Testable Code (for Magento 1 and 2)  2016 Romaina
Writing Testable Code (for Magento 1 and 2) 2016 Romaina
 
Writing Testable Code (for Magento 1 and 2)
Writing Testable Code (for Magento 1 and 2)Writing Testable Code (for Magento 1 and 2)
Writing Testable Code (for Magento 1 and 2)
 
Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)
 
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
 
Getting your hands dirty testing Magento 2 (at MageTitansIT)
Getting your hands dirty testing Magento 2 (at MageTitansIT)Getting your hands dirty testing Magento 2 (at MageTitansIT)
Getting your hands dirty testing Magento 2 (at MageTitansIT)
 
Architecture in-the-small-slides
Architecture in-the-small-slidesArchitecture in-the-small-slides
Architecture in-the-small-slides
 
Modern Module Architecture
Modern Module ArchitectureModern Module Architecture
Modern Module Architecture
 
The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014
 

Recently uploaded

Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 

Recently uploaded (20)

Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 

Hyvä: Compatibility Modules

  • 1. Howto Hyvä   Compatibility Modules! Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 2. How to make extensions that were built for Luma compatible with Hyvä... Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 3. Compatibility Modules Replace Luma code with Hyvä compatible templates: From ! To " # .phtml # .phtml $ .less # .phtml % .js # .phtml & .html # .phtml Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 4. Compatibility Modules From ! To .phtml " # .phtml ✨ HTML5 % .less Tailwind CSS ✨ & .js ✨ vanilla + Alpine.js ' .html HTML5 + Alpine.js ✨ Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 5.   Need to use a module? Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 6. Need to use a module?   First Check the compat module tracker — If it already is compatible: — If not, open an issue in the tracker: Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 7. Need to use a module?   Second Request a skeleton compat module In Slack, request a skeleton compat module, with both — the original module Magento_Name — the original module composer package/name Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 8. What does a skeleton repo contain? . ├── LICENSE.md ├── README.md ├── composer.json └── src ├── etc │   ├── frontend │   │   └── di.xml │   └── module.xml └── registration.php Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 9. $ cat composer.json { "name": "hyva-themes/magento2-orig-module", "description": "Hyvä Themes Compatibility module for Orig_Module", "type": "magento2-module", "require": { "magento/framework": "*", "hyva-themes/magento2-compat-module-fallback": "*", "orig/module": "*" } ... } Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 10. $ cat src/etc/frontend/di.xml <config> <type name="HyvaCompatModuleFallbackModelCompatModuleRegistry"> <arguments> <argument name="compatModules" xsi:type="array"> <item name="hyva-magento2-orig-module" xsi:type="array"> <item name="original_module" xsi:type="string">Orig_Module</item> <item name="compat_module" xsi:type="string">Hyva_OrigModule</item> </item> </argument> </arguments> </type> </config> Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 11. The CompatModuleRegistry    What is it good for? Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 12.   Automatic Template Overrides Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 13. Automatic Template Overrides — Original module Smile_ElasticsuiteCatalog view/frontend/templates/layer/view.phtml — Two alternative override options in Hyva_SmileElasticsuiteCatalog: view/frontend/templates/layer/view.phtml view/frontend/templates/Smile_ElasticsuiteCatalog/layer/view.phtml Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 14.   Other tools Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 15. Luma Reference Store View ! Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 16. Hyvä Prefix Layout Updates Luma: default.xml customer_address_edit.xml customer_account.xml Hyvä: default.xml hyva_default.xml customer_address_edit.xml hyva_customer_address_edit.xml customer_account.xml hyva_customer_account.xml Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 17. Is this Hyvä? In Observers / Plugins: Does the requested store view have a Hyvä theme? Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 18. Is this Hyvä? public function __construct( HyvaThemeServiceCurrentTheme $currentTheme ) { $this->currentTheme = $currentTheme; } public function execute(Event $event) { if (!$this->currentTheme->isHyva()) { return; } Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 19. First steps Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 20. Step by Step 1. Copy offending template into compat module 2. Rewrite JavaScript 3. Rewrite Styles 4. Repeat Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 21.   Rewrite JavaScript Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 22. Rewrite Luma JavaScript to 1. Vanilla JS 2. Alpine JS 3. External JS Libraries Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 23. Vanilla JS <script> function ebizmartsMailChimpCampaignCatcher() { // ... } window.addEventListener('DOMContentLoaded', ebizmartsMailChimpCampaignCatcher); </script> Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 24. Alpine JS <script> function initCheckoutGiftCards() { return { receiveSectionData(data) { ... }, toggleGiftcardForm() { ... }, } } </script> <div x-data="initCheckoutGiftCards()" @private-content-loaded.window="receiveSectionData($event.detail.data)"> <div @click="toggleGiftcardForm" @keydown.enter="toggleGiftcardForm"> Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 25. External JS Library <div id="fake-widget-placeholder"> ... </div> <script> (function() { function init() { const script = document.createElement('script') script.src = '<?= $escaper->escapeUrl($block->getViewFileUrl('My_Module/js/my-library.js')) ?>'; // The function initLibrary would be provided by the external JS script.addEventListener('load', () => initLibrary('fake-widget-placeholder')); document.head.append(script); } document.body.addEventListener('touchstart', init, {once: true}); document.body.addEventListener('mouseover', init, {once: true}); })(); </script> Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 26.   jQuery ➡ Vanilla JS Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 27. jQuery ➡ Vanilla JS jQuery $('#product-addtocart-button') .click(function(e) { e.preventDefault(); // some custom check // if ok $('#product_addtocart_form') .submit(); }); Vanilla document .getElementById('product-addtocart-button') .addEventListener('click', (e) => { e.preventDefault(); // some custom check // if ok document .getElementById('product_addtocart_form') .submit(); }) Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 28. jQuery ➡ Vanilla JS https://youMightNotNeedjQuery.com/ Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 29. Ajax / GraphQL ➡ fetch() fetch( url + '?form_key=' + hyva.getFormKey(), { method: 'post', body: JSON.stringify(data), headers: {contentType: 'application/json'} } ) .then(response => response.json()) .then(result => { // ... }) Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 30. window.hyva — hyva.getCookie(name) — hyva.setCookie(name, value, days, skipSetDomain) — hyva.getBrowserStorage() — hyva.postForm(postParams) — hyva.getFormKey() — hyva.formatPrice(value, showSign) Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 31. Customer Section Data <div x-data="" @private-content-loaded.window="console.log($event.detail.data)"></div> { messages: {...}, customer: {...}, compare-products: {...}, last-ordered-items: {...}, cart: {...}, directory-data: {...}, instant-purchase: {...}, loggedAsCustomer: {...}, captcha: {...}, persistent: {...}, review: {...}, wishlist: {...}, recently_viewed_product: {...}, recently_compared_product: {...}, product_data_storage: {...}, paypal-billing-agreement': {...} } Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 32. Reload Customer Section Data no automatic invalidation window.dispatchEvent( new CustomEvent("reload-customer-section-data") ); Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 33.   Rewrite Styles Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 34. Replace Luma styles Luma <ul class="compare wrapper"> <li class="item link compare"> <a class="action compare no-display" title="Compare products" Hyvä <div class="flex items-center order-3"> <a id="compare-link" class="relative invisible inline-block mx-1 no-underline sm:ml-3 hover:text-black" title="Compare Products" Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 35. Remove additional .less styles ➡ replace with inline Tailwind CSS classes <!-- Remove in compat module layout XML --> <remove src="Magezon_Core::css/styles.css"/> Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 36.     External non-Luma CSS Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 37. External non-Luma CSS Used in Critical Rendering Path? <remove src="Amasty_ShopbyBase::css/swiper.min.css"/> ➡ replace with inline Tailwind CSS classes Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 38. External non-Luma CSS Not part of Critical Rendering Path? document.addEventListener('DOMContentLoaded', function () { function init() { const link = document.createElement('link') link.rel = 'stylesheet'; link.type = 'text/css'; link.href = '<?= $escaper->escapeUrl($block->getViewFileUrl('Ho_Templatehints::css/hints.css')) ?>'; document.head.append(link); } document.body.addEventListener('touchstart', init, {once: true}); document.body.addEventListener('mouseover', init, {once: true}); }, {once: true}); ➡ keep & load when needed Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 39. [Commercial] Windy Browser Plugin Automatically convert styles to Tailwind CSS! https://usewindy.com/ Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 40. PHP View Models Modern View Helpers /** @var HyvaThemeModelViewModelRegistry $viewModels */ $currentProduct = $viewModels->require( HyvaThemeViewModelCurrentProduct::class ); Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 41. PHP View Models <?php $modal = $viewModels->require(HyvaThemeViewModelModal::class) ->createModal() ->withTemplate('My_Module::my-dialog-content.phtml') ->withAriaLabel('Example modal with content template'); ?> <div x-data="hyva.modal()"> <button @click="show" type="button" class="btn"> <?= $escaper->escapeHtml(__('Show Modal')) ?> </button> <?= $modal ?> </div> Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 42.   Enjoy & Thanks! https://hyva.io @hyva_io @VinaiKopp Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io