{"id":2519,"date":"2018-01-09T03:49:59","date_gmt":"2018-01-09T03:49:59","guid":{"rendered":"http:\/\/myprojects.advchaweb.com\/?p=2519"},"modified":"2018-01-09T03:49:59","modified_gmt":"2018-01-09T03:49:59","slug":"magento-2-alan-storm-tutorial","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2018\/01\/09\/magento-2-alan-storm-tutorial\/","title":{"rendered":"Magento 2 Alan Storm Tutorial"},"content":{"rendered":"<p>REF: http:\/\/alanstorm.com\/category\/magento-2\/<\/p>\n<p>SETTING VirtualHost<br \/>\nREF:https:\/\/medium.com\/@JohnFoderaro\/how-to-set-up-apache-in-macos-sierra-10-12- bca5a5dfffba<br \/>\nMODIFY \/private\/etc\/apache2\/extra\/httpd-vhosts.conf:<br \/>\n&#8230;<br \/>\n&lt;VirtualHost *:80&gt;<br \/>\nServerName magentoce215.lcoal<br \/>\nServerAlias www.magentoce215.local<br \/>\nDocumentRoot &#8220;\/Library\/WebServer\/Documents\/Projects\/magentoce215&#8221;<br \/>\nDirectoryIndex index.php<br \/>\n&lt;Directory &#8220;\/Library\/WebServer\/Documents\/Projects\/magentoce215&#8221;&gt;<br \/>\nAllowOverride All<br \/>\nAllow from All<br \/>\nRequire all granted<br \/>\n&lt;\/Directory&gt;<\/p>\n<p>ErrorLog &#8220;\/private\/var\/log\/apache2\/magentoce215_error.log&#8221;<br \/>\nCustomLog &#8220;\/private\/var\/log\/apache2\/magentoce215_access.log&#8221; common<br \/>\n&lt;\/VirtualHost&gt;<\/p>\n<p>MODIFY \/etc\/hosts:<br \/>\n&#8230;<br \/>\n127.0.0.1 magentoce215.local<br \/>\n&#8230;<\/p>\n<p>RESTART APACHE: sudo apachectl restart<\/p>\n<p>OPEN http:\/\/magentoce215.local\/<\/p>\n<p>INSTALL PESTLE (https:\/\/github.com\/astorm\/pestle)<br \/>\nSatrias-MacBook-Pro:~ teddy$ curl -LO http:\/\/pestle.pulsestorm.net\/pestle.phar<br \/>\n% Total % Received % Xferd Average Speed Time Time Time Current<br \/>\nDload Upload Total Spent Left Speed<br \/>\n100 3990k 100 3990k 0 0 578k 0 0:00:06 0:00:06 &#8211;:&#8211;:&#8211; 860k<br \/>\nSatrias-MacBook-Pro:~ teddy$ php pestle.phar list-commands<\/p>\n<p>GO TO THE M2 ROOT PROJECT (\/Library\/WebServer\/Documents\/Projects\/magentoce215\/)<br \/>\nSatrias-MacBook-Pro:~ teddy$ cd \/Library\/WebServer\/Documents\/Projects\/magentoce215\/<\/p>\n<p>https:\/\/alanstorm.com\/magento_2_javascript_init_scripts\/<br \/>\nGO TO &#8216;app\/code&#8217; DIR: &#8211;&gt; NO NEED. JUST PESTLE.PHAR IN MAGENTO ROOT IS OKAY<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ cd app\/code\/<\/p>\n<p>THEN INSTALL PESTLE:<br \/>\nSatrias-MacBook-Pro:code teddy$ curl -LO http:\/\/pestle.pulsestorm.net\/pestle.phar<br \/>\n% Total % Received % Xferd Average Speed Time Time Time Current<br \/>\nDload Upload Total Spent Left Speed<br \/>\n100 3990k 100 3990k 0 0 860k 0 0:00:04 0:00:04 &#8211;:&#8211;:&#8211; 978k<\/p>\n<p>THEN RUN &#8216;php pestle.phar generate_module Pulsestorm JavascriptInitTutorial 0.0.1&#8217;<br \/>\nI HAVE TO USE &#8216;php&#8217; HERE BECAUSE IF NOT I&#8217;D GET AN ERROR MESSAGE &#8216;-bash: pestle.phar: command not found&#8217; REF:https:\/\/github.com\/astorm\/pestle\/issues\/120<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ php pestle.phar generate_module Pulsestorm JavascriptInitTutorial 0.0.1<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/etc\/module.xml<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/registration.php<\/p>\n<p>HERE ARE THE GENERATED FILES:<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/registration.php:<br \/>\n&lt;?php<br \/>\n\\Magento\\Framework\\Component\\ComponentRegistrar::register(<br \/>\n\\Magento\\Framework\\Component\\ComponentRegistrar::MODULE,<br \/>\n&#8216;Pulsestorm_JavascriptInitTutorial&#8217;,<br \/>\n__DIR__<br \/>\n);<\/p>\n<p>\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/etc\/module.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;config xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:framework:Module\/etc\/module.xsd&#8221;&gt;<br \/>\n&lt;module name=&#8221;Pulsestorm_JavascriptInitTutorial&#8221; setup_version=&#8221;0.0.1&#8243;\/&gt;<br \/>\n&lt;\/config&gt;<\/p>\n<p>THEN<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_route Pulsestorm_JavascriptInitTutorial frontend pulsestorm_javascriptinittutorial<br \/>\nController name? (Index)]<br \/>\nAction name? (Index)]<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/etc\/frontend\/routes.xml<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/Controller\/Index\/Index.php<\/p>\n<p>HERE ARE THE GENERATED FILES:<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/etc\/frontend\/routes.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;config xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:framework:App\/etc\/routes.xsd&#8221;&gt;<br \/>\n&lt;router id=&#8221;standard&#8221;&gt;<br \/>\n&lt;route id=&#8221;pulsestorm_javascriptinittutorial&#8221; frontName=&#8221;pulsestorm_javascriptinittutorial&#8221;&gt;<br \/>\n&lt;module name=&#8221;Pulsestorm_JavascriptInitTutorial&#8221;\/&gt;<br \/>\n&lt;\/route&gt;<br \/>\n&lt;\/router&gt;<br \/>\n&lt;\/config&gt;<\/p>\n<p>AND<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/Controller\/Index\/Index.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\JavascriptInitTutorial\\Controller\\Index;<br \/>\nclass Index extends \\Magento\\Framework\\App\\Action\\Action<br \/>\n{<\/p>\n<p>protected $resultPageFactory;<br \/>\npublic function __construct(<br \/>\n\\Magento\\Framework\\App\\Action\\Context $context,<br \/>\n\\Magento\\Framework\\View\\Result\\PageFactory $resultPageFactory)<br \/>\n{<br \/>\n$this-&gt;resultPageFactory = $resultPageFactory;<br \/>\nparent::__construct($context);<br \/>\n}<\/p>\n<p>public function execute()<br \/>\n{<br \/>\nreturn $this-&gt;resultPageFactory-&gt;create();<br \/>\n}<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<p>THEN<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_view Pulsestorm_JavascriptInitTutorial frontend pulsestorm_javascriptinittutorial_index_index Main content.phtml 1column<br \/>\nCreating \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/templates\/content.phtml<br \/>\nCreating: Pulsestorm\\JavascriptInitTutorial\\Block\\Main<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/layout\/pulsestorm_javascriptinittutorial_index_index.xml<\/p>\n<p>HERE ARE THE GENERATED FILES:<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/templates\/content.phtml:<br \/>\n&lt;h1&gt;This is my template, there are many like it, but this one is mine.&lt;\/h1&gt;<\/p>\n<p>AND<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/layout\/pulsestorm_javascriptinittutorial_index_index.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;page xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; layout=&#8221;1column&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd&#8221;&gt;<br \/>\n&lt;referenceBlock name=&#8221;content&#8221;&gt;&lt;block template=&#8221;content.phtml&#8221; class=&#8221;Pulsestorm\\JavascriptInitTutorial\\Block\\Main&#8221; name=&#8221;pulsestorm_javascriptinittutorial_block_main&#8221;\/&gt;&lt;\/referenceBlock&gt;&lt;\/page&gt;<\/p>\n<p>AND<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/Block\/Main.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\JavascriptInitTutorial\\Block;<br \/>\nclass Main extends \\Magento\\Framework\\View\\Element\\Template<br \/>\n{<br \/>\nfunction _prepareLayout(){}<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<p>THEN I HAVE TO GO UP THE MAGENTO ROOT THEN LOGIN AS &#8216;sudo -s -u _www&#8217;:<br \/>\nSatrias-MacBook-Pro:code teddy$ php bin\/magento module:enable Pulsestorm_JavascriptInitTutorial<br \/>\nCould not open input file: bin\/magento<br \/>\nSatrias-MacBook-Pro:code teddy$ cd ..<br \/>\nSatrias-MacBook-Pro:app teddy$ cd ..<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_JavascriptInitTutorial<br \/>\nCommand line user does not have read and write permissions on var\/generation directory. Please address this issue before using Magento command line.<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ sudo -s -u _www<br \/>\nPassword:<br \/>\nbash-3.2$ php bin\/magento module:enable Pulsestorm_JavascriptInitTutorial<br \/>\nThe following modules have been enabled:<br \/>\n&#8211; Pulsestorm_JavascriptInitTutorial<\/p>\n<p>To make sure that the enabled modules are properly registered, run &#8216;setup:upgrade&#8217;.<br \/>\nCache cleared successfully.<br \/>\nGenerated classes cleared successfully. Please run the &#8216;setup:di:compile&#8217; command to generate classes.<br \/>\nInfo: Some modules might require static view files to be cleared. To do this, run &#8216;module:enable&#8217; with the &#8211;clear-static-content option to clear them.<\/p>\n<p>THEN THE LAST:<br \/>\nbash-3.2$ php bin\/magento setup:upgrade<\/p>\n<p>TEST THE ROUTE URL: http:\/\/magentoce215.local\/pulsestorm_javascriptinittutorial\/<br \/>\nIT&#8217;D PRINT:<br \/>\n&#8216;This is my template, there are many like it, but this one is mine.&#8217;<\/p>\n<p>Setting up a RequireJS Module<br \/>\nCREATE A NEW FILE: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/web\/example.js:<br \/>\ndefine([],function(){<br \/>\nalert(&#8220;A simple RequireJS Module&#8221;);<br \/>\nreturn {};<br \/>\n});<\/p>\n<p>THEN MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/templates\/content.phtml:<br \/>\n&lt;h1&gt;This is my template, there are many like it, but this one is mine.&lt;\/h1&gt;<\/p>\n<p>&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\nrequirejs([&#8216;Pulsestorm_JavascriptInitTutorial\/example&#8217;], function(example){<br \/>\nalert(&#8216;Loaded!&#8217;);<br \/>\nconsole.log(example);<br \/>\n});<br \/>\n&lt;\/script&gt;<\/p>\n<p>RUN: php bin\/magento c:f<br \/>\nTHEN TEST AGAIN: http:\/\/magentoce215.local\/pulsestorm_javascriptinittutorial\/<br \/>\nIT&#8217;D WORK AS EXPECTED. THE TWO ALERT &#8220;A simple RequireJS Module&#8221; THEN &#8216;Loaded!&#8217; WOULD BE POPED UP. ALSO THE CONSOLE WOULD PRINT &#8216;{}&#8217;<\/p>\n<p>X-Magento-Init<br \/>\nPURPOSES:<br \/>\nprovides a way to pass that program a server side generated JSON object.<br \/>\nprovides a way to provide that program with the DOM nodes it should operate on.<\/p>\n<p>MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/templates\/content.phtml:<br \/>\n&lt;!&#8211;h1&gt;This is my template, there are many like it, but this one is mine.&lt;\/h1&#8211;&gt;<\/p>\n<p>&lt;!&#8211;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\nrequirejs([&#8216;Pulsestorm_JavascriptInitTutorial\/example&#8217;], function(example){<br \/>\nalert(&#8216;Loaded!&#8217;);<br \/>\nconsole.log(example);<br \/>\n});<br \/>\n&lt;\/script&#8211;&gt;<\/p>\n<p>&lt;div id=&#8221;one&#8221; class=&#8221;foo&#8221;&gt;<br \/>\nHello World<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div id=&#8221;two&#8221; class=&#8221;foo&#8221;&gt;<br \/>\nGoodbye World<br \/>\n&lt;\/div&gt;<\/p>\n<p>&lt;script type=&#8221;text\/x-magento-init&#8221;&gt;<br \/>\n{<br \/>\n&#8220;*&#8221;: {<br \/>\n&#8220;Pulsestorm_JavascriptInitTutorial\/example&#8221;:{}<br \/>\n}<br \/>\n}<br \/>\n&lt;\/script&gt;<\/p>\n<p>RUN: php bin\/magento c:f<br \/>\nTHEN TEST AGAIN: http:\/\/magentoce215.local\/pulsestorm_javascriptinittutorial\/<br \/>\nIT&#8217;D SHOW ALERT &#8220;A simple RequireJS Module&#8221;<br \/>\nBUT THEN I GOT AN ERROR:<br \/>\nREFER TO: http:\/\/magentoce215.local\/pub\/static\/version1513154325\/frontend\/Magento\/luma\/en_US\/mage\/apply\/main.js<br \/>\nUncaught TypeError: Cannot read property &#8216;bind&#8217; of undefined<br \/>\nat main.js:26<br \/>\nat Object.execCb (require.js:1650)<br \/>\nat Module.check (require.js:866)<br \/>\nat Module.&lt;anonymous&gt; (require.js:1113)<br \/>\nat require.js:132<br \/>\nat require.js:1156<br \/>\nat each (require.js:57)<br \/>\nat Module.emit (require.js:1155)<br \/>\nat Module.check (require.js:917)<br \/>\nat Module.enable (require.js:1143)<br \/>\nSOLUTION: &#8216;The reason for this error? Because there\u2019s no mage\/menu key in the returned object.&#8217;<br \/>\nREF: https:\/\/alanstorm.com\/requirejs-modules-that-return-two-widgets\/<br \/>\nSO JUST FOLLOW BELOW &#8216;Magento Javascript Components&#8217;!<\/p>\n<p>Magento Javascript Components<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/web\/example.js:<br \/>\n\/*<br \/>\ndefine([],function(){<br \/>\nalert(&#8220;A simple RequireJS Module&#8221;);<br \/>\nreturn {};<br \/>\n});<br \/>\n*\/<br \/>\ndefine([], function () {<br \/>\nvar mageJsComponent = function()<br \/>\n{<br \/>\nalert(&#8220;A simple magento component.&#8221;);<br \/>\n};<\/p>\n<p>return mageJsComponent;<br \/>\n});<\/p>\n<p>RUN: CLEAR CACHE<br \/>\nTHEN RELOAD: http:\/\/magentoce215.local\/pulsestorm_javascriptinittutorial\/<br \/>\nIT&#8217;D SHOW THE ALERT &#8220;A simple magento component.&#8221;<br \/>\nALSO THE ABOVE CONSOLE ERROR WOULD gone<\/p>\n<p>WE CAN PASS PARAMETER TO THE REQUIREJS MODULE\/COMPONENT (pass in server side generated JSON &#8211;&gt; A SAMPLE FOR &#8216;provides a way to pass that program a server side generated JSON object.&#8217;)<br \/>\nFOR EXAMPLE PASS A PAIR KEY-VALUE PARAM &#8216;config&#8217;:&#8217;value&#8217;:<br \/>\nMODIFY AGAIN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/templates\/content.phtml:<br \/>\n&#8230;<br \/>\n&lt;script type=&#8221;text\/x-magento-init&#8221;&gt;<br \/>\n{<br \/>\n&#8220;*&#8221;: {<br \/>\n&#8220;Pulsestorm_JavascriptInitTutorial\/example&#8221;:{&#8220;config&#8221;:&#8221;value&#8221;}<br \/>\n}<br \/>\n}<br \/>\n&lt;\/script&gt;<\/p>\n<p>THEN MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/web\/example.js:<br \/>\n&#8230;<br \/>\ndefine([], function () {<br \/>\nvar mageJsComponent = function(config)<br \/>\n{<br \/>\n\/\/alert(&#8220;A simple magento component.&#8221;);<br \/>\nalert(&#8220;Look in your browser&#8217;s console&#8221;);<br \/>\nconsole.log(config);<br \/>\n};<\/p>\n<p>return mageJsComponent;<br \/>\n});<\/p>\n<p>RELOAD THE BROWSER!<br \/>\nCONSOLE PRINTED:<br \/>\n{config: &#8220;value&#8221;}<br \/>\nconfig:&#8221;value&#8221;<br \/>\n__proto__:Object<\/p>\n<p>HERE IS A SAMPLE FOR &#8216;provides a way to provide that program with the DOM nodes it should operate on.&#8217;:<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/web\/example.js:<br \/>\ndefine([], function () {<br \/>\nvar mageJsComponent = function(config, node)<br \/>\n{<br \/>\n\/\/alert(&#8220;A simple magento component.&#8221;);<br \/>\n\/\/alert(&#8220;Look in your browser&#8217;s console&#8221;);<br \/>\nconsole.log(config);<br \/>\nconsole.log(node);<br \/>\n};<\/p>\n<p>return mageJsComponent;<br \/>\n});<\/p>\n<p>THEN MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/templates\/content.phtml:<br \/>\n&lt;div id=&#8221;one&#8221; class=&#8221;foo&#8221;&gt;<br \/>\nHello World<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div id=&#8221;two&#8221; class=&#8221;foo&#8221;&gt;<br \/>\nGoodbye World<br \/>\n&lt;\/div&gt;<\/p>\n<p>&lt;script type=&#8221;text\/x-magento-init&#8221;&gt;<br \/>\n{<br \/>\n&#8220;#one&#8221;:{<br \/>\n&#8220;Pulsestorm_JavascriptInitTutorial\/example&#8221;:{&#8220;config&#8221;:&#8221;value&#8221;}<br \/>\n}<br \/>\n}<br \/>\n&lt;\/script&gt;<\/p>\n<p>THEN CLEAR CACHE<br \/>\nAND RELOAD: http:\/\/magentoce215.local\/pulsestorm_javascriptinittutorial\/<br \/>\nIT&#8217;D PRINT THE OUTPUT ON CONSOLE:<br \/>\n{config: &#8220;value&#8221;}<br \/>\nexample.js:13 &lt;div id=\u200b&#8221;one&#8221; class=\u200b&#8221;foo&#8221; data-mspdevtools=\u200b&#8221;e076e2cbb07c8dc89e933bef9d185479&#8243;&gt;\u200b<br \/>\nHello World<br \/>\n\u200b&lt;\/div&gt;\u200b<\/p>\n<p>OR IF<br \/>\n&lt;script type=&#8221;text\/x-magento-init&#8221;&gt;<br \/>\n{<br \/>\n&#8220;.foo&#8221;:{<br \/>\n&#8220;Pulsestorm_JavascriptInitTutorial\/example&#8221;:{&#8220;config&#8221;:&#8221;value&#8221;}<br \/>\n}<br \/>\n}<br \/>\n&lt;\/script&gt;<\/p>\n<p>THE OUTPUT CONSOLE WOULD BE:<br \/>\n{config: &#8220;value&#8221;}<br \/>\nexample.js:13 &lt;div id=\u200b&#8221;one&#8221; class=\u200b&#8221;foo&#8221; data-mspdevtools=\u200b&#8221;e076e2cbb07c8dc89e933bef9d185479&#8243;&gt;\u200b<br \/>\nHello World<br \/>\n\u200b&lt;\/div&gt;\u200b<br \/>\nexample.js:12 {config: &#8220;value&#8221;}<br \/>\nexample.js:13 &lt;div id=\u200b&#8221;two&#8221; class=\u200b&#8221;foo&#8221; data-mspdevtools=\u200b&#8221;e076e2cbb07c8dc89e933bef9d185479&#8243;&gt;\u200b<br \/>\nGoodbye World<br \/>\n\u200b&lt;\/div&gt;\u200b<\/p>\n<p>&nbsp;<\/p>\n<p>Data-mage-init Attribute<\/p>\n<p>In addition to &lt;script type=&#8221;text\/x-magento-init&#8221;&gt;, there\u2019s another way to invoke similar functionality on a specific DOM node, and that\u2019s with the data-mage-init attribute.<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptInitTutorial\/view\/frontend\/templates\/content.phtml:<br \/>\n&lt;div data-mage-init='{&#8220;Pulsestorm_JavascriptInitTutorial\/example&#8221;: {&#8220;another&#8221;:&#8221;example&#8221;}}&#8217;&gt;A single div&lt;\/div&gt;<\/p>\n<p>THEN CLEAR THE CACHE<br \/>\nAND RELOAD.<br \/>\nHERE IS THE CONSOLE PRINTED:<br \/>\n{another: &#8220;example&#8221;}<br \/>\nexample.js:13 &lt;div data-mspdevtools=\u200b&#8221;e076e2cbb07c8dc89e933bef9d185479&#8243;&gt;\u200bA single div\u200b&lt;\/div&gt;\u200b<\/p>\n<p>KnockoutJS Primer for Magento Developers<br \/>\nhttps:\/\/alanstorm.com\/knockoutjs_primer_for_magento_developers\/<br \/>\nJUST AN INTRODUCTION<\/p>\n<p>Magento 2: KnockoutJS Integration<br \/>\nhttps:\/\/alanstorm.com\/magento_2_knockoutjs_integration\/<\/p>\n<p>Creating a Magento Module<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ cd app\/code\/<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_module Pulsestorm KnockoutTutorial 0.0.1<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/KnockoutTutorial\/etc\/module.xml<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/KnockoutTutorial\/registration.php<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ php pestle.phar generate_route Pulsestorm_KnockoutTutorial frontend pulsestorm_knockouttutorial<br \/>\nController name? (Index)]<br \/>\nAction name? (Index)]<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/KnockoutTutorial\/etc\/frontend\/routes.xml<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/KnockoutTutorial\/Controller\/Index\/Index.php<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ php pestle.phar generate_view Pulsestorm_KnockoutTutorial frontend pulsestorm_knockouttutorial_index_index Main content.phtml 1column<br \/>\nCreating \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/KnockoutTutorial\/view\/frontend\/templates\/content.phtml<br \/>\nCreating: Pulsestorm\\KnockoutTutorial\\Block\\Main<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/KnockoutTutorial\/view\/frontend\/layout\/pulsestorm_knockouttutorial_index_index.xml<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ cd ..<br \/>\nSatrias-MacBook-Pro:app teddy$ cd ..<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_KnockoutTutorial<br \/>\nThe following modules have been enabled:<br \/>\n&#8211; Pulsestorm_KnockoutTutorial<\/p>\n<p>To make sure that the enabled modules are properly registered, run &#8216;setup:upgrade&#8217;.<br \/>\nCache cleared successfully.<br \/>\nGenerated classes cleared successfully. Please run the &#8216;setup:di:compile&#8217; command to generate classes.<br \/>\nInfo: Some modules might require static view files to be cleared. To do this, run &#8216;module:enable&#8217; with the &#8211;clear-static-content option to clear them.<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento setup:upgrade<br \/>\n&#8230;<br \/>\nModule &#8216;Pulsestorm_KnockoutTutorial&#8217;:<br \/>\nPlease re-run Magento compile command<\/p>\n<p>TEST: http:\/\/magentoce215.local\/pulsestorm_knockouttutorial<\/p>\n<p>NOTE: I NEED TO DISABLE Inchoo_ModalOverlay MODULE BECAUSE IT&#8217;S ANNOYING TO SHOW THE POPUP EACH TIME I REFRESH THE BROWSER! PROBABLY I NEED TO WRITE A TUTORIAL HOW TO WRITE THIS KIND OF MODULE (SHOW THE POPUP ON EACH PAGE)<\/p>\n<p>MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/KnockoutTutorial\/view\/frontend\/templates\/content.phtml:<br \/>\n&lt;!&#8211;h1&gt;This is my template, there are many like it, but this one is mine.&lt;\/h1&#8211;&gt;<br \/>\n&lt;div data-bind=&#8221;template:&#8217;Pulsestorm_KnockoutTutorial\/hello'&#8221;&gt;&lt;\/div&gt;<\/p>\n<p>THEN ADD A NEW FILE hello.html IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/KnockoutTutorial\/view\/frontend\/web\/template\/hello.html:<br \/>\n&lt;p data-bind=&#8221;style:{fontSize:&#8217;24px&#8217;}&#8221;&gt;Hello World&lt;\/p&gt;<\/p>\n<p>CLEAR CACHE AND RELOAD.<br \/>\nIT&#8217;D PRINT &#8216;Hello World&#8217;<\/p>\n<p>The Curious Case of Magento 2 Mixins<br \/>\nhttps:\/\/alanstorm.com\/the-curious-case-of-magento-2-mixins\/<\/p>\n<p>Magento 2 RequireJS Mixins<br \/>\nA Magento 2 RequireJS \u201cmixin\u201d allows you to programmatically listen for the initial instantiation of any RequireJS module and manipulate that module before returning it.<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ cd app\/code\/<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_module Pulsestorm RequireJsRewrite 0.0.1<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/RequireJsRewrite\/etc\/module.xml<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/RequireJsRewrite\/registration.php<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ cd ..<br \/>\nSatrias-MacBook-Pro:app teddy$ cd ..<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_RequireJsRewrite &amp;&amp; php bin\/magento setup:upgrade<\/p>\n<p>CREATE A NEW FILE &#8216;requirejs-config.js&#8217; IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/RequireJsRewrite\/view\/base\/requirejs-config.js:<br \/>\nvar config = {<br \/>\n&#8216;config&#8217;:{<br \/>\n&#8216;mixins&#8217;:{<br \/>\n&#8216;Magento_Customer\/js\/view\/customer&#8217;:{<br \/>\n&#8216;Pulsestorm_RequireJsRewrite\/hook&#8217;:true<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n};<\/p>\n<p>THEN CREATE A NEW FILE &#8216;hook.js&#8217; IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/RequireJsRewrite\/view\/base\/web\/hook.js:<br \/>\ndefine([], function(){<br \/>\n&#8216;use strict&#8217;;<br \/>\nconsole.log(&#8220;Called this hook.&#8221;);<br \/>\nreturn function(targetModule){<br \/>\ntargetModule.crazyPropertyAddedHere = &#8216;yes&#8217;;<br \/>\nreturn targetModule;<br \/>\n};<br \/>\n});<\/p>\n<p>CLEAR THE CACHE THE TEST IT ON the Magento homepage (or any page which uses the Magento_Customer\/js\/view\/customer RequireJS module): http:\/\/magentoce215.local\/<br \/>\nIT&#8217;D PRINT ON THE CONSOLE: &#8220;Called this hook.&#8221;<br \/>\nAlso, if you examine the Magento_Customer\/js\/view\/customer module via the console, you\u2019ll see it has an extra crazyPropertyAddedHere property:<br \/>\nmodule = requirejs(&#8220;Magento_Customer\/js\/view\/customer&#8221;);<br \/>\n\u0192 () {<br \/>\nvar obj = this;<\/p>\n<p>if (!_.isObject(obj) || Object.getPrototypeOf(obj) !== UiClass.prototype) {<br \/>\nobj = Object.create(UiClass.prototype);<br \/>\n\u2026<br \/>\nconsole.log(module.crazyPropertyAddedHere);<br \/>\nVM2475:1 yes<\/p>\n<p>With the above code, we changed the object returned by the Magento_Customer\/js\/view\/customer module. If used judiciously, this is an incredibly powerful feature.<\/p>\n<p>Class Rewrites for Javascript<\/p>\n<p>&nbsp;<\/p>\n<p>Knockout Observables for Javascript Programmers<br \/>\nhttps:\/\/alanstorm.com\/knockout-observables-for-javascript-programmers\/<\/p>\n<p>Important: Subscribers are only called when a value changes. If you pass in the observable\u2019s current value, Knockout will not call subscriber callbacks<\/p>\n<p>&nbsp;<\/p>\n<p>Modifying a jQuery Widget in Magento 2<br \/>\nhttps:\/\/alanstorm.com\/modifying-a-jquery-widget-in-magento-2\/<\/p>\n<p>Creating our Mixin<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ cd app\/code\/<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_module Pulsestorm Logdropdown 0.0.1<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/Logdropdown\/etc\/module.xml<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/Logdropdown\/registration.php<\/p>\n<p>CREATE A NEW FILE &#8216;requirejs-config.js&#8217; IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/Logdropdown\/view\/base\/requirejs-config.js:<br \/>\nvar config = {<br \/>\n&#8216;config&#8217;:{<br \/>\n&#8216;mixins&#8217;:{<br \/>\n&#8216;mage\/dropdown&#8217;:{<br \/>\n&#8216;Pulsestorm_Logdropdown\/js\/dropdown-mixin&#8217;:true<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n};<\/p>\n<p>THEN CREATE A REQUIREJS MODULE &#8216;dropdown-mixin.js&#8217; IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/Logdropdown\/view\/base\/web\/js\/dropdown-mixin.js:<br \/>\ndefine([&#8216;jquery&#8217;], function($){<br \/>\nreturn function(originalWidget){<br \/>\nalert(&#8216;Our mixin is hooked up.&#8217;);<br \/>\nconsole.log(&#8216;Our mixin is hooked up.&#8217;);<br \/>\nconsole.log(originalWidget);<\/p>\n<p>return originalWidget;<br \/>\n};<br \/>\n});<\/p>\n<p>THEN ENABLE THE MODULE:<br \/>\nSatrias-MacBook-Pro:code teddy$ cd ..<br \/>\nSatrias-MacBook-Pro:app teddy$ cd ..<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_Logdropdown &amp;&amp; php bin\/magento setup:upgrade<\/p>\n<p>LOAD ON ANY PAGE that uses the dropdownWidget widget (home page, catalog listing page, etc), and you should see an alert and a console.log message that says Our mixin is hooked up.<\/p>\n<p>\u0192 ( options, element ) {<br \/>\n\/\/ allow instantiation without &#8220;new&#8221; keyword<br \/>\nif ( !this._createWidget ) {<br \/>\nreturn new constructor( options, element );<br \/>\n}<\/p>\n<p>\/\/ allow instantiation without initializing \u2026<\/p>\n<p>Changing a Widget<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/Logdropdown\/view\/base\/web\/js\/dropdown-mixin.js:<br \/>\ndefine([&#8216;jquery&#8217;], function($){<br \/>\nreturn function(originalWidget){<br \/>\n\/*alert(&#8216;Our mixin is hooked up.&#8217;);<br \/>\nconsole.log(&#8216;Our mixin is hooked up.&#8217;);<br \/>\nconsole.log(originalWidget);<\/p>\n<p>return originalWidget;*\/<br \/>\n\/\/ if you want to get fancy and pull the widget namespace<br \/>\n\/\/ and name from the returned widget definition<br \/>\n\/\/ var widgetFullName = originalWidget.prototype.namespace +<br \/>\n\/\/ &#8216;.&#8217; +<br \/>\n\/\/ originalWidget.prototype.widgetName;<\/p>\n<p>&nbsp;<\/p>\n<p>$.widget(<br \/>\n&#8216;mage.dropdownDialog&#8217;, \/\/named widget we&#8217;re redefining<\/p>\n<p>\/\/$.mage.dropdownDialog<br \/>\n$[&#8216;mage&#8217;][&#8216;dropdownDialog&#8217;], \/\/widget definition to use as<br \/>\n\/\/a &#8220;parent&#8221; definition &#8212; in<br \/>\n\/\/this case the original widget<br \/>\n\/\/definition, accessed using<br \/>\n\/\/bracket syntax instead of<br \/>\n\/\/dot syntax<\/p>\n<p>{ \/\/the new methods<br \/>\nopen:function(){<br \/>\n\/\/our new code here<br \/>\nconsole.log(&#8220;I opened a dropdown!&#8221;);<\/p>\n<p>\/\/call parent open for original functionality<br \/>\nreturn this._super();<\/p>\n<p>}<br \/>\n});<\/p>\n<p>\/\/return the redefined widget for `data-mage-init`<br \/>\n\/\/jQuery.mage.dropdownDialog<br \/>\nreturn $[&#8216;mage&#8217;][&#8216;dropdownDialog&#8217;];<br \/>\n};<br \/>\n});<\/p>\n<p>With the above in place, clear your browser cache and reload the page. Then, click on any dropdown widget on the page \u2014 the currency\/store-views are good candidates<\/p>\n<p>After clicking on these menus and confirming everything still works, take a look at your javascript console \u2014 you should see the I opened a dropdown! text successfully logged.<\/p>\n<p>&nbsp;<\/p>\n<p>Introduction to Magento 2 \u2014 No More MVC<br \/>\nhttps:\/\/alanstorm.com\/magento_2_mvvm_mvc\/<\/p>\n<p>CREATE A NEW MODULE &#8216;HelloWorldMVVM&#8217;:<br \/>\nCREATE A NEW FILE &#8216;registration.php&#8217; IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/registration.php:<br \/>\n&lt;?php<br \/>\n\\Magento\\Framework\\Component\\ComponentRegistrar::register(<br \/>\n\\Magento\\Framework\\Component\\ComponentRegistrar::MODULE,<br \/>\n&#8216;Pulsestorm_HelloWorldMVVM&#8217;,<br \/>\n__DIR__<br \/>\n);<\/p>\n<p>CREATE A NEW FILE &#8216;module.xml&#8217; IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/etc\/module.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;config xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;..\/..\/..\/..\/..\/lib\/internal\/Magento\/Framework\/Module\/etc\/module.xsd&#8221;&gt;<br \/>\n&lt;module name=&#8221;Pulsestorm_HelloWorldMVVM&#8221; setup_version=&#8221;0.0.1&#8243; \/&gt;<br \/>\n&lt;\/config&gt;<\/p>\n<p>ENABLE THE MODULE: Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_HelloWorldMVVM &amp;&amp; php bin\/magento setup:upgrade<\/p>\n<p>CREATE A NEW FRONTEND ROUTE &#8216;routes.xml&#8217; IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/etc\/frontend\/routes.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;config xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;..\/..\/..\/..\/..\/..\/lib\/internal\/Magento\/Framework\/App\/etc\/routes.xsd&#8221;&gt;<br \/>\n&lt;router id=&#8221;standard&#8221;&gt;<br \/>\n&lt;route id=&#8221;hello_mvvm&#8221; frontName=&#8221;hello_mvvm&#8221;&gt;<br \/>\n&lt;module name=&#8221;Pulsestorm_HelloWorldMVVM&#8221; \/&gt;<br \/>\n&lt;\/route&gt;<br \/>\n&lt;\/router&gt;<br \/>\n&lt;\/config&gt;<\/p>\n<p>CREATE A NEW CONTROLLER &#8216;Hello\/World.php&#8217; IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/Controller\/Hello\/World.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\HelloWorldMVVM\\Controller\\Hello;<\/p>\n<p>class World extends \\Magento\\Framework\\App\\Action\\Action {<br \/>\npublic function execute(){<br \/>\necho &#8216;You Did it!&#8217;;<br \/>\nvar_dump(__METHOD__);<br \/>\n}<br \/>\n}<\/p>\n<p>TEST THE ROUTE BY OPENING: http:\/\/magentoce215.local\/hello_mvvm\/hello\/world<br \/>\nIT&#8217;D PRINT:<br \/>\nYou Did it!<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/Controller\/Hello\/World.php:7:string &#8216;Pulsestorm\\HelloWorldMVVM\\Controller\\Hello\\World::execute&#8217; (length=57)<\/p>\n<p>&nbsp;<\/p>\n<p>Passing off to the View<br \/>\nMODIFY AGAIN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/Controller\/Hello\/World.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\HelloWorldMVVM\\Controller\\Hello;<br \/>\nuse Magento\\Framework\\View\\Result\\PageFactory;<br \/>\nuse Magento\\Framework\\App\\Action\\Context;<\/p>\n<p>class World extends \\Magento\\Framework\\App\\Action\\Action<br \/>\n{<br \/>\nprotected $pageFactory;<br \/>\npublic function __construct(Context $context, PageFactory $pageFactory)<br \/>\n{<br \/>\n$this-&gt;pageFactory = $pageFactory;<br \/>\nreturn parent::__construct($context);<br \/>\n}<\/p>\n<p>public function execute()<br \/>\n{<br \/>\nvar_dump(__METHOD__);<br \/>\n$page_object = $this-&gt;pageFactory-&gt;create();<br \/>\nreturn $page_object;<br \/>\n}<br \/>\n}<\/p>\n<p>BUT I GOT THIS ERROR ON RELOADING: http:\/\/magentoce215.local\/hello_mvvm\/hello\/world<br \/>\nFatal error: Uncaught TypeError: Argument 2 passed to Pulsestorm\\HelloWorldMVVM\\Controller\\Hello\\World::__construct() must be an instance of Magento\\Framework\\View\\Result\\PageFactory, none given, called in \/Library\/WebServer\/Documents\/Projects\/magentoce215\/var\/generation\/Pulsestorm\/HelloWorldMVVM\/Controller\/Hello\/World\/Interceptor.php on line 14 and defined in \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/Controller\/Hello\/World.php on line 9<br \/>\n( ! ) TypeError: Argument 2 passed to Pulsestorm\\HelloWorldMVVM\\Controller\\Hello\\World::__construct() must be an instance of Magento\\Framework\\View\\Result\\PageFactory, none given, called in \/Library\/WebServer\/Documents\/Projects\/magentoce215\/var\/generation\/Pulsestorm\/HelloWorldMVVM\/Controller\/Hello\/World\/Interceptor.php on line 14 in \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/Controller\/Hello\/World.php on line 9<br \/>\nSOLUTION: I NEED TO REMOVE THE var\/generation DIRECTORY!!! CLEAR THE CACHE IS NOT ENOUGH!!!<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ sudo rm -rf var\/*<br \/>\nPassword:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento c:f<\/p>\n<p>HERE IS THE OUTPUT: (NO CONTENT YET) http:\/\/magentoce215.local\/hello_mvvm\/hello\/world<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/Controller\/Hello\/World.php:17:string &#8216;Pulsestorm\\HelloWorldMVVM\\Controller\\Hello\\World::execute&#8217; (length=57)<\/p>\n<p>Creating the View<br \/>\nADD A NEW LAYOUT &#8216;hello_mvvm_hello_world.xml&#8217; (THIS FILENAME IS FULL ACTION NAME. THE COMBINATION FROM frontName\/ID: hello_mvvm AND CONTROLLER &amp; CLASS NAME: hello_world) IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/view\/frontend\/layout\/hello_mvvm_hello_world.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;page xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; layout=&#8221;1column&#8221; xsi:noNamespaceSchemaLocation=&#8221;..\/..\/..\/..\/..\/..\/..\/lib\/internal\/Magento\/Framework\/View\/Layout\/etc\/page_configuration.xsd&#8221;&gt;<br \/>\n&lt;referenceBlock name=&#8221;content&#8221;&gt;<br \/>\n&lt;block<br \/>\ntemplate=&#8221;content.phtml&#8221;<br \/>\nclass=&#8221;Pulsestorm\\HelloWorldMVVM\\Block\\Main&#8221;<br \/>\nname=&#8221;pulsestorm_helloworld_mvvm&#8221;\/&gt;<br \/>\n&lt;\/referenceBlock&gt;<br \/>\n&lt;\/page&gt;<\/p>\n<p>CREATE A BLOCK FILE &#8216;Main.php&#8217; IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/Block\/Main.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\HelloWorldMVVM\\Block;<br \/>\nuse Magento\\Framework\\View\\Element\\Template;<\/p>\n<p>class Main extends Template<br \/>\n{<br \/>\nprotected function _prepareLayout()<br \/>\n{<\/p>\n<p>}<br \/>\n}<\/p>\n<p>THEN CREATE A TEMPLATE FILE &#8216;content.phtml&#8217; IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/view\/frontend\/templates\/content.phtml:<br \/>\n&lt;h1&gt;Hello World&lt;\/h1&gt;<\/p>\n<p>CLEAR THE CACHE AND RELOAD! http:\/\/magentoce215.local\/hello_mvvm\/hello\/world<br \/>\nIT&#8217;D PRINT &#8216;Hello World&#8217; WITH THE MAGENTO LUMA TEMPLATE<\/p>\n<p>View\/View Model<br \/>\nMODIFY AGAIN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/Block\/Main.php: &#8211;&gt; USE SET\/GET METHOD<br \/>\n&#8230;<br \/>\nprotected function _prepareLayout()<br \/>\n{<br \/>\n$this-&gt;setMessage(&#8216;Hello Again World&#8217;);<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>THEN CALL IT FROM \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/view\/frontend\/templates\/content.phtml:<br \/>\n&lt;h1&gt;&lt;?php echo $this-&gt;escapeHtml($this-&gt;getMessage()); ?&gt;&lt;\/h1&gt;<\/p>\n<p>CLEAR THE CACHE AND RELOAD: http:\/\/magentoce215.local\/hello_mvvm\/hello\/world<br \/>\nIT&#8217;D PRINT: &#8220;Hello Again World&#8221;<\/p>\n<p>OR MODIFY AGAIN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/Block\/Main.php. THEN ADD A NEW FUNCTION &#8216;getGoodbyeMessage&#8217;:<br \/>\n&#8230;<br \/>\npublic function getGoodbyeMessage()<br \/>\n{<br \/>\nreturn &#8216;Goodbye World&#8217;;<br \/>\n}<\/p>\n<p>CALL IT FROM \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/view\/frontend\/templates\/content.phtml:<br \/>\n&lt;h1&gt;&lt;?php echo $this-&gt;escapeHtml($this-&gt;getGoodbyeMessage()); ?&gt;&lt;\/h1&gt;<\/p>\n<p>CLEAR THE CACHE AND RELOAD: http:\/\/magentoce215.local\/hello_mvvm\/hello\/world<br \/>\nIT&#8217;D PRINT: Goodbye World<\/p>\n<p>USE PARAMS. FOR EXAMPLE WITH URL: http:\/\/magentoce215.local\/hello_mvvm\/hello\/world\/name\/satria<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/Block\/Main.php:<br \/>\n&#8230;<br \/>\nprotected function _prepareLayout()<br \/>\n{<br \/>\n$this-&gt;setMessage(&#8216;Hello Again World&#8217;);<br \/>\n$this-&gt;setName($this-&gt;getRequest()-&gt;getParam(&#8216;name&#8217;));<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>THEN MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloWorldMVVM\/view\/frontend\/templates\/content.phtml:<br \/>\n&lt;h1&gt;<br \/>\n&lt;?php echo $this-&gt;escapeHtml($this-&gt;getMessage()); ?&gt;<br \/>\n&lt;?php echo $this-&gt;escapeHtml($this-&gt;getName()); ?&gt;<br \/>\n&lt;\/h1&gt;<\/p>\n<p>&lt;h2&gt;&lt;?php echo $this-&gt;escapeHtml($this-&gt;getGoodbyeMessage()); ?&gt;&lt;\/h2&gt;<\/p>\n<p>CLEAR THE CACHE AND RELOAD: http:\/\/magentoce215.local\/hello_mvvm\/hello\/world\/name\/satria<br \/>\nIT&#8217;D PRINT:<br \/>\nHello Again World satria<br \/>\nGoodbye World<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2: Adding Frontend Assets via Layout XML<br \/>\nhttps:\/\/alanstorm.com\/magento_2_javascript_css_layout_woes\/<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ php pestle.phar generate_module Pulsestorm JavascriptCssExample 0.0.1<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/etc\/module.xml<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/registration.php<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ php pestle.phar generate_route Pulsestorm_JavascriptCssExample frontend pulsestorm_javascriptcssexample<br \/>\nController name? (Index)]<br \/>\nAction name? (Index)]<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/etc\/frontend\/routes.xml<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/Controller\/Index\/Index.php<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ php pestle.phar generate_view Pulsestorm_JavascriptCssExample frontend pulsestorm_javascriptcssexample_index_index Main content.phtml<br \/>\nLayout (ignored for adminhtml) ? (1column)]<br \/>\nCreating \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/view\/frontend\/templates\/content.phtml<br \/>\nCreating: Pulsestorm\\JavascriptCssExample\\Block\\Main<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/view\/frontend\/layout\/pulsestorm_javascriptcssexample_index_index.xml<\/p>\n<p>&nbsp;<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_JavascriptCssExample &amp;&amp; php bin\/magento setup:upgrade<\/p>\n<p>TEST IT ON http:\/\/magentoce215.local\/pulsestorm_javascriptcssexample<\/p>\n<p>MODIFY TO ADD JS AND CSS ON \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/view\/frontend\/layout\/pulsestorm_javascriptcssexample_index_index.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;page xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; layout=&#8221;1column&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd&#8221;&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;css src=&#8221;Pulsestorm_JavascriptCssExample::test.css&#8221;\/&gt;<br \/>\n&lt;link src=&#8221;Pulsestorm_JavascriptCssExample::test.js&#8221;\/&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;referenceBlock name=&#8221;content&#8221;&gt;&lt;block template=&#8221;content.phtml&#8221; class=&#8221;Pulsestorm\\JavascriptCssExample\\Block\\Main&#8221; name=&#8221;pulsestorm_javascriptcssexample_block_main&#8221;\/&gt;&lt;\/referenceBlock&gt;&lt;\/page&gt;<\/p>\n<p>ADD \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/view\/frontend\/web\/test.js:<br \/>\nalert(&#8220;Hello&#8221;);<\/p>\n<p>THEN ADD \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/view\/frontend\/web\/test.js:<br \/>\nbody{<br \/>\nbackground-color:#f00;<br \/>\n}<\/p>\n<p>CLEAR CACHE AND RELOAD: http:\/\/magentoce215.local\/pulsestorm_javascriptcssexample<br \/>\nIT&#8217;S SHOW &#8216;Hello&#8217; AND THE BG COLOR WOULD BE CHANGED TO RED<\/p>\n<p>Adding Files Via PHP<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/view\/frontend\/layout\/pulsestorm_javascriptcssexample_index_index.xml:<br \/>\n&lt;page xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; layout=&#8221;1column&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd&#8221;&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;css src=&#8221;Pulsestorm_JavascriptCssExample::test.css&#8221;\/&gt;<br \/>\n&lt;link src=&#8221;Pulsestorm_JavascriptCssExample::test.js&#8221;\/&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;referenceBlock name=&#8221;content&#8221;&gt;<br \/>\n&lt;block template=&#8221;content.phtml&#8221;<br \/>\nclass=&#8221;Pulsestorm\\JavascriptCssExample\\Block\\Main&#8221;<br \/>\nname=&#8221;pulsestorm_javascriptcssexample_block_main&#8221;\/&gt;<br \/>\n&lt;\/referenceBlock&gt;<br \/>\n&lt;referenceBlock name=&#8221;head.additional&#8221;&gt;<br \/>\n&lt;block template=&#8221;head.phtml&#8221;<br \/>\nclass=&#8221;Pulsestorm\\JavascriptCssExample\\Block\\Head&#8221;<br \/>\nname=&#8221;pulsestorm_javascriptcssexample_block_head&#8221; \/&gt;<br \/>\n&lt;\/referenceBlock&gt;<br \/>\n&lt;\/page&gt;<\/p>\n<p>ADD \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/Block\/Head.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\JavascriptCssExample\\Block;<br \/>\nclass Head extends \\Magento\\Framework\\View\\Element\\Template<br \/>\n{<\/p>\n<p>}<\/p>\n<p>THEN ADD \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/view\/frontend\/templates\/head.phtml:<br \/>\n&lt;!&#8211; Hello There &#8211;&gt;<\/p>\n<p>CLEAR THE CACHE AND RELOAD: http:\/\/magentoce215.local\/pulsestorm_javascriptcssexample<br \/>\nTHEN IT&#8217;D PRINT &#8216;&lt;!&#8211; Hello There &#8211;&gt;&#8217; IN &#8216;head.additional&#8217; BLOCK<\/p>\n<p>The Asset Repository<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/Block\/Head.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\JavascriptCssExample\\Block;<br \/>\nclass Head extends \\Magento\\Framework\\View\\Element\\Template<br \/>\n{<br \/>\npublic $assetRepository;<br \/>\npublic function __construct(<br \/>\n\\Magento\\Framework\\View\\Element\\Template\\Context $context,<br \/>\narray $data = [],<br \/>\n\\Magento\\Framework\\View\\Asset\\Repository $assetRepository<br \/>\n)<br \/>\n{<br \/>\n$this-&gt;assetRepository = $assetRepository;<br \/>\nreturn parent::__construct($context, $data);<br \/>\n}<br \/>\n}<\/p>\n<p>THEN MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/JavascriptCssExample\/view\/frontend\/templates\/head.phtml:<br \/>\n@highlightsyntax@php<br \/>\n&lt;?php<br \/>\n$asset_repository = $this-&gt;assetRepository;<br \/>\n$asset = $asset_repository-&gt;createAsset(&#8216;Pulsestorm_JavascriptCssExample::test.js&#8217;);<br \/>\n$url = $asset-&gt;getUrl();<br \/>\n?&gt;<br \/>\n&lt;!&#8211; Hello There &#8211;&gt;<br \/>\n&lt;script src=&#8221;&lt;?php echo $url; ?&gt;&#8221;&gt;&lt;\/script&gt;<\/p>\n<p>CLEAR THE CACHE AND RELOAD: http:\/\/magentoce215.local\/pulsestorm_javascriptcssexample<br \/>\nTHEN IT&#8217;D PRINT &#8216;&lt;!&#8211; Hello There &#8211;&gt;&#8217; IN &#8216;head.additional&#8217; BLOCK THEN CREATE A SCRIPT:<br \/>\n&lt;script src=&#8221;http:\/\/magentoce215.local\/pub\/static\/version1513654716\/frontend\/Magento\/luma\/en_US\/Pulsestorm_JavascriptCssExample\/test.js&#8221;&gt;&lt;\/script&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2: CRUD Models for Database Access<br \/>\nhttps:\/\/alanstorm.com\/magento_2_crud_models_for_database_access\/<\/p>\n<p>Creating a Base Module<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ cd app\/code<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_module Pulsestorm ToDoCrud 0.0.1<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/etc\/module.xml<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/registration.php<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ php pestle.phar generate_route Pulsestorm_ToDoCrud frontend pulsestorm_todocrud<br \/>\nController name? (Index)]<br \/>\nAction name? (Index)]<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/etc\/frontend\/routes.xml<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/Controller\/Index\/Index.php<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ php pestle.phar generate_view Pulsestorm_ToDoCrud frontend pulsestorm_todocrud_index_index Main content.phtml<br \/>\nLayout (ignored for adminhtml) ? (1column)]<br \/>\nCreating \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/view\/frontend\/templates\/content.phtml<br \/>\nCreating: Pulsestorm\\ToDoCrud\\Block\\Main<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/view\/frontend\/layout\/pulsestorm_todocrud_index_index.xml<\/p>\n<p>Generating Crud Files<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_crud_model Pulsestorm_ToDoCrud TodoItem<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/Api\/TodoItemRepositoryInterface.php<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/Model\/TodoItemRepository.php<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/Api\/Data\/TodoItemInterface.php<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/Model\/ResourceModel\/TodoItem\/Collection.php<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/Model\/ResourceModel\/TodoItem.php<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/Model\/TodoItem.php<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/Setup\/InstallSchema.php<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/Setup\/InstallData.php<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ cd ..<br \/>\nSatrias-MacBook-Pro:app teddy$ cd ..<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_ToDoCrud &amp;&amp; php bin\/magento setup:upgrade<\/p>\n<p>TEST IT: http:\/\/magentoce215.local\/pulsestorm_todocrud<\/p>\n<p>Magento 2 Factory Objects<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/Block\/Main.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\ToDoCrud\\Block;<\/p>\n<p>use Magento\\Framework\\View\\Element\\Template\\Context;<br \/>\nuse Pulsestorm\\ToDoCrud\\Model\\TodoItemFactory;<\/p>\n<p>class Main extends \\Magento\\Framework\\View\\Element\\Template<br \/>\n{<br \/>\nprotected $todoFactory;<\/p>\n<p>public function __construct(Context $context, TodoItemFactory $todoFactory){<br \/>\n$this-&gt;todoFactory = $todoFactory;<br \/>\nparent::__construct($context);<br \/>\n}<\/p>\n<p>function _prepareLayout(){<br \/>\n\/\/var_dump(&#8220;I&#8217;m here&#8221;);<br \/>\nvar_dump(get_class($this-&gt;todoFactory));<br \/>\nexit;<br \/>\n}<br \/>\n}<\/p>\n<p>CLEAR THE CACHE (IF NEEDED CLEAR var\/* DIR) THEN RELOAD: http:\/\/magentoce215.local\/pulsestorm_todocrud<br \/>\nIT&#8217;D PRINT: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/Block\/Main.php:18:string &#8216;Pulsestorm\\ToDoCrud\\Model\\TodoItemFactory&#8217; (length=41)<\/p>\n<p>MODIFY AGAIN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/Block\/Main.php:<br \/>\n&#8230;<br \/>\nfunction _prepareLayout(){<br \/>\n\/\/var_dump(&#8220;I&#8217;m here&#8221;);<br \/>\n\/\/var_dump(get_class($this-&gt;todoFactory));<br \/>\n$todo = $this-&gt;todoFactory-&gt;create();<br \/>\n$todo-&gt;setData(&#8216;item_text&#8217;,&#8217;Finish my Magento article&#8217;)<br \/>\n-&gt;save();<br \/>\nvar_dump(&#8216;Done&#8217;);<br \/>\nexit;<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>CLEAR CACHE &amp; RELOAD: http:\/\/magentoce215.local\/pulsestorm_todocrud<\/p>\n<p>CHECK THE TABLE IN PHPMYADMIN:<br \/>\nselect * from pulsestorm_todocrud_todoitem<\/p>\n<p>_prepareLayout() function could be:<br \/>\n&#8230;<br \/>\nfunction _prepareLayout(){<br \/>\n\/\/var_dump(&#8220;I&#8217;m here&#8221;);<br \/>\n\/\/var_dump(get_class($this-&gt;todoFactory));<br \/>\n$todo = $this-&gt;todoFactory-&gt;create();<br \/>\n$collection = $todo-&gt;getCollection();<br \/>\n\/\/$todo-&gt;setData(&#8216;item_text&#8217;,&#8217;Finish my Magento article&#8217;)<br \/>\n\/\/-&gt;save();<br \/>\n\/\/var_dump(&#8216;Done&#8217;);<br \/>\n\/\/$todo = $todo-&gt;load(1);<br \/>\n\/\/var_dump($todo-&gt;getData());<br \/>\nforeach($collection as $item){<br \/>\nvar_dump(&#8220;Item ID:&#8221;.$item-&gt;getId());<br \/>\nvar_dump($item-&gt;getData());<br \/>\n}<br \/>\nexit;<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2: Understanding Object Repositories<br \/>\nhttps:\/\/alanstorm.com\/magento_2_understanding_object_repositories\/<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ cd app\/code\/<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_module Pulsestorm RepositoryTutorial 0.0.1<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/RepositoryTutorial\/etc\/module.xml<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/RepositoryTutorial\/registration.php<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ php pestle.phar generate_command Pulsestorm_RepositoryTutorial Examples<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/RepositoryTutorial<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_RepositoryTutorial &amp;&amp; php bin\/magento setup:upgrade<\/p>\n<p>TEST THE COMMAND FROM \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/RepositoryTutorial\/Command\/Examples.php:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:examples<br \/>\nHello World<\/p>\n<p>MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/RepositoryTutorial\/Command\/Examples.php:<br \/>\n&#8230;<br \/>\nuse Magento\\Framework\\ObjectManagerInterface;<br \/>\nuse Magento\\Framework\\App\\State;<\/p>\n<p>class Examples extends Command<br \/>\n{<br \/>\nprotected $objectManager;<\/p>\n<p>public function __construct(ObjectManagerInterface $objectManager, State $appState, $name = null){<br \/>\n$this-&gt;objectManager = $objectManager;<br \/>\n$appState-&gt;setAreaCode(&#8216;frontend&#8217;);<br \/>\nparent::__construct($name);<br \/>\n}<\/p>\n<p>&#8230;<\/p>\n<p>protected function execute(InputInterface $input, OutputInterface $output)<br \/>\n{<br \/>\n\/\/$output-&gt;writeln(&#8220;Hello World&#8221;);<br \/>\n$repo = $this-&gt;objectManager-&gt;get(&#8216;Magento\\Catalog\\Model\\ProductRepository&#8217;);<br \/>\n$page = $repo-&gt;getById(2);<br \/>\n$output-&gt;writeln(get_class($page));<br \/>\n}<br \/>\n}<\/p>\n<p>TEST THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:examples<br \/>\nMagento\\Catalog\\Model\\Product\\Interceptor<\/p>\n<p>WE CAN GET THE PRODUCT NAME:<br \/>\n&#8230;<br \/>\nprotected function execute(InputInterface $input, OutputInterface $output)<br \/>\n{<br \/>\n\/\/$output-&gt;writeln(&#8220;Hello World&#8221;);<br \/>\n$repo = $this-&gt;objectManager-&gt;get(&#8216;Magento\\Catalog\\Model\\ProductRepository&#8217;);<br \/>\n$page = $repo-&gt;getById(2);<br \/>\n\/\/$output-&gt;writeln(get_class($page));<br \/>\n\/\/$output-&gt;writeln($page-&gt;getTitle()); \/\/EMPTY!!!<br \/>\n$output-&gt;writeln($page-&gt;getName());<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:examples<br \/>\nStrive Shoulder Pack<\/p>\n<p>&#8230;<br \/>\nprotected function execute(InputInterface $input, OutputInterface $output)<br \/>\n{<br \/>\n\/\/$output-&gt;writeln(&#8220;Hello World&#8221;);<br \/>\n$repo = $this-&gt;objectManager-&gt;get(&#8216;Magento\\Catalog\\Model\\ProductRepository&#8217;);<br \/>\n$page = $repo-&gt;getById(2);<br \/>\n\/\/$output-&gt;writeln(get_class($page));<br \/>\n\/\/$output-&gt;writeln($page-&gt;getTitle()); \/\/EMPTY!!!<br \/>\n\/\/$output-&gt;writeln($page-&gt;getName());<br \/>\n\/*$page-&gt;setTitle($page-&gt;getTitle().&#8221;, Edited by code&#8221;);<br \/>\n$repo-&gt;save($page);<br \/>\n$output-&gt;writeln($page-&gt;getTitle());*\/<br \/>\n$page-&gt;setId(null);<br \/>\n$page-&gt;setTitle(&#8220;My duplicated page&#8221;);<br \/>\n$repo-&gt;save($page);<br \/>\n$output-&gt;writeln($page-&gt;getId());<br \/>\n$output-&gt;writeln($page-&gt;getTitle());<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>BUT I GOT AN ERROR:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:examples<\/p>\n<p>&nbsp;<\/p>\n<p>[Magento\\Framework\\Exception\\AlreadyExistsException]<br \/>\nURL key for specified store already exists.<\/p>\n<p>&nbsp;<\/p>\n<p>ps:examples<\/p>\n<p>SEARCH CRITERIA<br \/>\nMODIFY<br \/>\n&#8230;<br \/>\nprotected function execute(InputInterface $input, OutputInterface $output)<br \/>\n{<br \/>\n\/\/$output-&gt;writeln(&#8220;Hello World&#8221;);<br \/>\n$repo = $this-&gt;objectManager-&gt;get(&#8216;Magento\\Catalog\\Model\\ProductRepository&#8217;);<br \/>\n\/\/$page = $repo-&gt;getById(2);<br \/>\n$search_criteria = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\SearchCriteriaInterface&#8217;);<\/p>\n<p>$result = $repo-&gt;getList($search_criteria);<br \/>\n$products = $result-&gt;getItems();<\/p>\n<p>foreach($products as $item){<br \/>\n$output-&gt;writeln($item-&gt;getName());<br \/>\n}<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>TEST:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:examples<br \/>\nJoust Duffle Bag<br \/>\nStrive Shoulder Pack<br \/>\nCrown Summit Backpack<br \/>\n&#8230;.<\/p>\n<p>MODIFY TO GET ALL PRODUCT CONTAIN\/END WITH NAME &#8216;backpack&#8217;:<br \/>\n&#8230;<br \/>\nprotected function execute(InputInterface $input, OutputInterface $output)<br \/>\n{<br \/>\n\/\/create a filter<br \/>\n$filter = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\Filter&#8217;);<br \/>\n$filter-&gt;setData(&#8216;field&#8217;, &#8216;name&#8217;);<br \/>\n$filter-&gt;setData(&#8216;value&#8217;, &#8216;%backpack&#8217;);<br \/>\n$filter-&gt;setData(&#8216;condition_type&#8217;, &#8216;like&#8217;);<\/p>\n<p>\/\/add the filter to a group<br \/>\n$filter_group = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\Search\\FilterGroup&#8217;);<br \/>\n$filter_group-&gt;setData(&#8216;filters&#8217;, [$filter]);<\/p>\n<p>\/\/$output-&gt;writeln(&#8220;Hello World&#8221;);<br \/>\n$repo = $this-&gt;objectManager-&gt;get(&#8216;Magento\\Catalog\\Model\\ProductRepository&#8217;);<br \/>\n\/\/$page = $repo-&gt;getById(2);<br \/>\n$search_criteria = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\SearchCriteriaInterface&#8217;);<br \/>\n\/\/add the filter group to the search criteria object<br \/>\n$search_criteria-&gt;setFilterGroups([$filter_group]);<\/p>\n<p>$result = $repo-&gt;getList($search_criteria);<br \/>\n$products = $result-&gt;getItems();<\/p>\n<p>foreach($products as $item){<br \/>\n$output-&gt;writeln($item-&gt;getName());<br \/>\n}<br \/>\n}<br \/>\n&#8230;.<\/p>\n<p>TEST:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:examples<br \/>\nCrown Summit Backpack<br \/>\nFusion Backpack<br \/>\nEndeavor Daytrip Backpack<br \/>\nDriven Backpack<\/p>\n<p>ADD ANOTHER FILTER (WOULD CREATE &#8216;OR&#8217; JOIN):<br \/>\n&#8230;<br \/>\nprotected function execute(InputInterface $input, OutputInterface $output)<br \/>\n{<br \/>\n\/\/create a filter<br \/>\n$filter = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\Filter&#8217;);<br \/>\n$filter-&gt;setData(&#8216;field&#8217;, &#8216;name&#8217;);<br \/>\n$filter-&gt;setData(&#8216;value&#8217;, &#8216;%backpack&#8217;);<br \/>\n$filter-&gt;setData(&#8216;condition_type&#8217;, &#8216;like&#8217;);<\/p>\n<p>\/\/create another filter<br \/>\n$filter2 = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\Filter&#8217;);<br \/>\n$filter2-&gt;setData(&#8216;field&#8217;, &#8216;name&#8217;);<br \/>\n$filter2-&gt;setData(&#8216;value&#8217;, &#8216;%sprite%&#8217;);<br \/>\n$filter2-&gt;setData(&#8216;condition_type&#8217;, &#8216;like&#8217;);<\/p>\n<p>\/\/add the filter to a group<br \/>\n$filter_group = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\Search\\FilterGroup&#8217;);<br \/>\n$filter_group-&gt;setData(&#8216;filters&#8217;, [$filter, $filter2]);<\/p>\n<p>\/\/$output-&gt;writeln(&#8220;Hello World&#8221;);<br \/>\n$repo = $this-&gt;objectManager-&gt;get(&#8216;Magento\\Catalog\\Model\\ProductRepository&#8217;);<br \/>\n\/\/$page = $repo-&gt;getById(2);<br \/>\n$search_criteria = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\SearchCriteriaInterface&#8217;);<br \/>\n\/\/add the filter group to the search criteria object<br \/>\n$search_criteria-&gt;setFilterGroups([$filter_group]);<\/p>\n<p>$result = $repo-&gt;getList($search_criteria);<br \/>\n$products = $result-&gt;getItems();<\/p>\n<p>foreach($products as $item){<br \/>\n$output-&gt;writeln($item-&gt;getName());<br \/>\n}<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>TEST:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:examples<br \/>\nCrown Summit Backpack<br \/>\nFusion Backpack<br \/>\nEndeavor Daytrip Backpack<br \/>\nDriven Backpack<br \/>\nSprite Foam Yoga Brick<br \/>\nSprite Foam Roller<br \/>\nSprite Stasis Ball 55 cm<br \/>\nSprite Stasis Ball 55 cm<br \/>\nSprite Stasis Ball 55 cm<br \/>\nSprite Stasis Ball 65 cm<br \/>\nSprite Stasis Ball 65 cm<br \/>\nSprite Stasis Ball 65 cm<br \/>\nSprite Stasis Ball 75 cm<br \/>\nSprite Stasis Ball 75 cm<br \/>\nSprite Stasis Ball 75 cm<br \/>\nSprite Yoga Strap 6 foot<br \/>\nSprite Yoga Strap 8 foot<br \/>\nSprite Yoga Strap 10 foot<br \/>\nSprite Yoga Companion Kit<br \/>\nSet of Sprite Yoga Straps<\/p>\n<p>ADD ANOTHER FILTER GROUP (WOULD CREATE &#8216;AND&#8217; JOIN):<br \/>\n&#8230;<br \/>\nprotected function execute(InputInterface $input, OutputInterface $output)<br \/>\n{<br \/>\n\/\/create a filter<br \/>\n$filter = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\Filter&#8217;);<br \/>\n$filter-&gt;setData(&#8216;field&#8217;, &#8216;name&#8217;);<br \/>\n$filter-&gt;setData(&#8216;value&#8217;, &#8216;%sport%&#8217;);<br \/>\n$filter-&gt;setData(&#8216;condition_type&#8217;, &#8216;like&#8217;);<\/p>\n<p>\/\/create another filter<br \/>\n$filter2 = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\Filter&#8217;);<br \/>\n$filter2-&gt;setData(&#8216;field&#8217;, &#8216;name&#8217;);<br \/>\n$filter2-&gt;setData(&#8216;value&#8217;, &#8216;%black%&#8217;);<br \/>\n$filter2-&gt;setData(&#8216;condition_type&#8217;, &#8216;like&#8217;);<\/p>\n<p>\/\/add the filter to a group<br \/>\n$filter_group = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\Search\\FilterGroup&#8217;);<br \/>\n$filter_group-&gt;setData(&#8216;filters&#8217;, [$filter]);<\/p>\n<p>\/\/add the filter2 to another group<br \/>\n$filter_group2 = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\Search\\FilterGroup&#8217;);<br \/>\n$filter_group2-&gt;setData(&#8216;filters&#8217;, [$filter2]);<\/p>\n<p>\/\/$output-&gt;writeln(&#8220;Hello World&#8221;);<br \/>\n$repo = $this-&gt;objectManager-&gt;get(&#8216;Magento\\Catalog\\Model\\ProductRepository&#8217;);<br \/>\n\/\/$page = $repo-&gt;getById(2);<br \/>\n$search_criteria = $this-&gt;objectManager-&gt;create(&#8216;Magento\\Framework\\Api\\SearchCriteriaInterface&#8217;);<br \/>\n\/\/add the filter group to the search criteria object<br \/>\n$search_criteria-&gt;setFilterGroups([$filter_group, $filter_group2]);<\/p>\n<p>$result = $repo-&gt;getList($search_criteria);<br \/>\n$products = $result-&gt;getItems();<\/p>\n<p>foreach($products as $item){<br \/>\n$output-&gt;writeln($item-&gt;getName());<br \/>\n}<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>TEST:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:examples<br \/>\nSupernova Sport Pant-32-Black<br \/>\nSupernova Sport Pant-33-Black<br \/>\nSupernova Sport Pant-34-Black<br \/>\nSupernova Sport Pant-36-Black<br \/>\nRapha Sports Short-32-Black<br \/>\nRapha Sports Short-33-Black<br \/>\nRapha Sports Short-34-Black<br \/>\nRapha Sports Short-36-Black<\/p>\n<p>&nbsp;<\/p>\n<p>Helper Class with Dependency Injection<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2: Understanding Access Control List Rules<br \/>\nhttps:\/\/alanstorm.com\/magento_2_understanding_access_control_list_rules\/<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ cd app\/code\/<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_module Pulsestorm AclExample 0.0.1<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/AclExample\/etc\/module.xml<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/AclExample\/registration.php<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_AclExample &amp;&amp; php bin\/magento setup:upgrade<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ cd app\/code\/<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_acl Pulsestorm_AclExample Pulsestorm_AclExample::top,Pulsestorm_AclExample::config<br \/>\nCreated \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/AclExample\/etc\/acl.xml<\/p>\n<p>CREATED \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/AclExample\/etc\/acl.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;config xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:framework:Acl\/etc\/acl.xsd&#8221;&gt;<br \/>\n&lt;acl&gt;<br \/>\n&lt;resources&gt;<br \/>\n&lt;resource id=&#8221;Magento_Backend::admin&#8221;&gt;<br \/>\n&lt;resource id=&#8221;Pulsestorm_AclExample::top&#8221; title=&#8221;Pulse Storm ACL Example Module&#8221;&gt;<br \/>\n&lt;resource id=&#8221;Pulsestorm_AclExample::config&#8221; title=&#8221;The First Rule&#8221;\/&gt;<br \/>\n&lt;resource id=&#8221;Pulsestorm_AclExample::more_rules&#8221; title=&#8221;The Second Rule&#8221;\/&gt;<br \/>\n&lt;\/resource&gt;<br \/>\n&lt;\/resource&gt;<br \/>\n&lt;\/resources&gt;<br \/>\n&lt;\/acl&gt;<br \/>\n&lt;\/config&gt;<\/p>\n<p>take a look at the Roles menu at System -&gt; User Roles -&gt; Add\/Edit Role -&gt; Role Resources. You should see your rules added to the system<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2: Admin Menu Items<br \/>\nhttps:\/\/alanstorm.com\/magento_2_admin_menu_items\/<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ cd app\/code\/<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_module Pulsestorm MenuTutorial 0.0.1<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/MenuTutorial\/etc\/module.xml<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/MenuTutorial\/registration.php<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ cd ..\/..<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_MenuTutorial &amp;&amp; php bin\/magento setup:upgrade<\/p>\n<p>ADD \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/MenuTutorial\/etc\/adminhtml\/menu.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;config xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:module:Magento_Backend:etc\/menu.xsd&#8221;&gt;<br \/>\n&lt;menu&gt;<br \/>\n&lt;add id=&#8221;Pulsestorm_MenuTutorial::top_level_example&#8221;<br \/>\ntitle=&#8221;Top Level Example&#8221;<br \/>\nmodule=&#8221;Pulsestorm_MenuTutorial&#8221;<br \/>\nsortOrder=&#8221;9999&#8243;<br \/>\nresource=&#8221;Magento_Backend::content&#8221;<br \/>\n\/&gt;<br \/>\n&lt;\/menu&gt;<br \/>\n&lt;\/config&gt;<\/p>\n<p>With the above in place, clear your Magento cache and load a backend page. You should see a new, top level Menu Item at the bottom of the admin navigation<\/p>\n<p>ADD ADMIN SUB MENU<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/MenuTutorial\/etc\/adminhtml\/menu.xml:<br \/>\n&#8230;<br \/>\n&lt;!&#8211; START: new node &#8211;&gt;<br \/>\n&lt;add id=&#8221;Pulsestorm_MenuTutorial::second_level_example&#8221;<br \/>\ntitle=&#8221;Second Level Example&#8221;<br \/>\nmodule=&#8221;Pulsestorm_MenuTutorial&#8221;<br \/>\nsortOrder=&#8221;9999&#8243;<br \/>\nresource=&#8221;Magento_Backend::content&#8221;<\/p>\n<p>parent=&#8221;Pulsestorm_MenuTutorial::top_level_example&#8221;<br \/>\naction=&#8221;cms\/page\/index&#8221;<br \/>\n\/&gt;<br \/>\n&lt;!&#8211; END: new node &#8211;&gt;<br \/>\n&#8230;<\/p>\n<p>ADD ADMIN SUB SUB MENU<br \/>\n&#8230;<br \/>\n&lt;!&#8211; ADD L3 &#8211;&gt;<br \/>\n&lt;add id=&#8221;Pulsestorm_MenuTutorial::third_level_example&#8221;<br \/>\ntitle=&#8221;Third Level Example&#8221;<br \/>\nmodule=&#8221;Pulsestorm_MenuTutorial&#8221;<br \/>\nsortOrder=&#8221;9999&#8243;<br \/>\nresource=&#8221;Magento_Backend::content&#8221;<\/p>\n<p>parent=&#8221;Pulsestorm_MenuTutorial::second_level_example&#8221;<br \/>\naction=&#8221;cms\/page\/index&#8221;<br \/>\n\/&gt;<br \/>\n&#8230;<\/p>\n<p>&nbsp;<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ cd app\/code\/<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_acl<br \/>\nWhich Module? (Pulsestorm_HelloWorld)] Pulsestorm_MenuTutorial<br \/>\nRule IDs? (Pulsestorm_MenuTutorial::top,Pulsestorm_MenuTutorial::config,)] Pulsestorm_MenuTutorial::menu_items,Pulsestorm_MenuTutorial::example_1<br \/>\nCreated \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/MenuTutorial\/etc\/acl.xml<\/p>\n<p>MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/MenuTutorial\/etc\/acl.xml:<br \/>\n&#8230;<br \/>\n&lt;resource id=&#8221;Pulsestorm_MenuTutorial::menu_items&#8221; title=&#8221;Tutorial Menu Items&#8221;&gt;<br \/>\n&lt;resource id=&#8221;Pulsestorm_MenuTutorial::example_1&#8243; title=&#8221;First Example&#8221;\/&gt;<br \/>\n&lt;\/resource&gt;<br \/>\n&#8230;<\/p>\n<p>&nbsp;<\/p>\n<p>GENERATE MENU:<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_menu<br \/>\nModule Name? (Pulsestorm_HelloGenerate)] Pulsestorm_MenuTutorial<br \/>\nIs this a new top level menu? (Y\/N) (N)] N<br \/>\nSelect Parent Menu:<br \/>\n[1] System (Magento_Backend::system)<br \/>\n[2] Customers (Magento_Customer::customer)<br \/>\n[3] Reports (Magento_Reports::report)<br \/>\n[4] Find Partners &amp; Extensions (Magento_Marketplace::partners)<br \/>\n[5] Sales (Magento_Sales::sales)<br \/>\n[6] Dashboard (Magento_Backend::dashboard)<br \/>\n[7] System (Magento_Backend::system)<br \/>\n[8] Marketing (Magento_Backend::marketing)<br \/>\n[9] Content (Magento_Backend::content)<br \/>\n[10] Stores (Magento_Backend::stores)<br \/>\n[11] Products (Magento_Catalog::catalog)<br \/>\n[12] (Magento_Backend::system_currency)<br \/>\n[13] Top Level Example (Pulsestorm_MenuTutorial::top_level_example)<br \/>\n()] 1<br \/>\nUse [Magento_Backend::system] as parent? (Y\/N) (N)] N<br \/>\nSelect Parent Menu:<br \/>\n[1] Report (Magento_Backend::system_report)<br \/>\n[2] Permissions (Magento_User::system_acl)<br \/>\n[3] Extensions (Magento_Integration::system_extensions)<br \/>\n[4] Tools (Magento_Backend::system_tools)<br \/>\n[5] Data Transfer (Magento_Backend::system_convert)<br \/>\n[6] Other Settings (Magento_Backend::system_other_settings)<br \/>\n()] 6<br \/>\nMenu Link ID (Pulsestorm_MenuTutorial::unique_identifier)] Pulsestorm_MenuTutorial::a_menu_item<br \/>\nACL Resource (Pulsestorm_MenuTutorial::a_menu_item)] Pulsestorm_MenuTutorial::example_1<br \/>\nLink Title (My Link Title)] Look at me, I&#8217;m a link<br \/>\nThree Segment Action (frontname\/index\/index)] pulsestorm_menututorial\/index\/index<br \/>\nSort Order? (10)] 9999<br \/>\nWriting: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/MenuTutorial\/etc\/adminhtml\/menu.xml<br \/>\nDone.<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2: Admin MVC\/MVVM Endpoints<br \/>\nhttps:\/\/alanstorm.com\/magento_2_admin_mvcmvvm_endpoints\/<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ cd app\/code\/<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_module Pulsestorm HelloAdminBackend 0.0.1<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloAdminBackend\/etc\/module.xml<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloAdminBackend\/registration.php<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ php pestle.phar generate_acl Pulsestorm_HelloAdminBackend Pulsestorm_HelloAdminBackend::top,Pulsestorm_HelloAdminBackend::menu_1<br \/>\nCreated \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloAdminBackend\/etc\/acl.xml<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ php pestle.phar generate_menu Pulsestorm_HelloAdminBackend Magento_Backend::system_other_settings Pulsestorm_HelloAdminBackend::a_menu_item Pulsestorm_HelloAdminBackend::menu_1 &#8220;Hello Admin Backend Pestle&#8221; pulsestorm_hello_admin_backend\/index\/index 1<br \/>\nWriting: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloAdminBackend\/etc\/adminhtml\/menu.xml<br \/>\nDone.<\/p>\n<p>Satrias-MacBook-Pro:code teddy$ cd ..\/..<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_HelloAdminBackend &amp;&amp; php bin\/magento setup:upgrade<\/p>\n<p>you\u2019ll have a Pulsestorm_HelloAdminBackend module with an ACL hierarchy defined, and a single Menu Item under System -&gt; Other Settings -&gt; Hello Admin Backend Pestle.<\/p>\n<p>CREATE ADMIN ROUTE<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ cd app\/code\/<br \/>\nSatrias-MacBook-Pro:code teddy$ php pestle.phar generate_route<br \/>\nWhich Module? (Pulsestorm_HelloWorld)] Pulsestorm_HelloAdminBackend<br \/>\nWhich Area (frontend, adminhtml)? (frontend)] adminhtml<br \/>\nFrontname\/Route ID? (pulsestorm_helloworld)] pulsestorm_hello_admin_backend<br \/>\nController name? (Index)]<br \/>\nAction name? (Index)]<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloAdminBackend\/etc\/adminhtml\/routes.xml<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloAdminBackend\/Controller\/Adminhtml\/Index\/Index.php<br \/>\nDon&#8217;t forget your menu.xml and acl.xml<br \/>\naction=&#8221;pulsestorm_hello_admin_backend\/index\/index&#8221;<br \/>\nid=&#8221;Pulsestorm_HelloAdminBackend::pulsestorm_hello_admin_backend_menu<\/p>\n<p>Clear your cache and generated class files, and then click on the Hello Admin Backend Pestle menu. If you\u2019re logged in as the Magento super user, you should be brought to a new, blank admin page!<\/p>\n<p>ALLOWED USER<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloAdminBackend\/Controller\/Adminhtml\/Index\/Index.php:<br \/>\n..<br \/>\nprotected function _isAllowed()<br \/>\n{<br \/>\nreturn $this-&gt;_authorization-&gt;isAllowed(&#8216;Pulsestorm_HelloAdminBackend::menu_1&#8217;);<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>ADD ADMIN CONTENT<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php pestle.phar generate_view<br \/>\nWhich Module? (Pulsestorm_HelloGenerate)] Pulsestorm_HelloAdminBackend<br \/>\nWhich Area? (frontend)] adminhtml<br \/>\nWhich Handle? (pulsestorm_helloadminbackend_index_index)] pulsestorm_hello_admin_backend_index_index<br \/>\nBlock Name? (Main)] Main<br \/>\nTemplate File? (content.phtml)] content.phtml<br \/>\nLayout (ignored for adminhtml) ? (1column)]<br \/>\nCreating \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloAdminBackend\/view\/adminhtml\/templates\/content.phtml<br \/>\nCreating: Pulsestorm\\HelloAdminBackend\\Block\\Adminhtml\\Main<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloAdminBackend\/view\/adminhtml\/layout\/pulsestorm_hello_admin_backend_index_index.xml<\/p>\n<p>After running pestle with the above arguments and clearing your cache, reload your page and you should see pestle\u2019s default block content.<\/p>\n<p>MENU HIGHLIGHT<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/HelloAdminBackend\/Controller\/Adminhtml\/Index\/Index.php:<br \/>\n&#8230;.<br \/>\npublic function execute()<br \/>\n{<br \/>\n\/\/return $this-&gt;resultPageFactory-&gt;create();<br \/>\n$page = $this-&gt;resultPageFactory-&gt;create();<br \/>\n$page-&gt;setActiveMenu(&#8216;Pulsestorm_HelloAdminBackend::a_menu_item&#8217;);<br \/>\nreturn $page;<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>SET DIFFERENT TITLE<br \/>\nMODIFY AGAIN<br \/>\n&#8230;<br \/>\npublic function execute()<br \/>\n{<br \/>\n\/\/return $this-&gt;resultPageFactory-&gt;create();<br \/>\n$page = $this-&gt;resultPageFactory-&gt;create();<br \/>\n$page-&gt;setActiveMenu(&#8216;Pulsestorm_HelloAdminBackend::a_menu_item&#8217;);<br \/>\n$page-&gt;getConfig()-&gt;getTitle()-&gt;prepend(__(&#8216;My New Title&#8217;));<br \/>\nreturn $page;<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2 Object Manager<br \/>\nhttps:\/\/alanstorm.com\/magento_2_object_manager\/<\/p>\n<p>DOWNLOAD https:\/\/github.com\/astorm\/magento2-tutorial-objectmanager1<br \/>\nAND FOLLOW THE INSTRUCTION TO PUT IN IN \/app\/code\/Pulsestorm\/ DIR<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_TutorialObjectManager1<\/p>\n<p>RUN THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-object-manager-1<br \/>\nYou did it!<\/p>\n<p>USE OBJECT MANAGER<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialObjectManager1\/Command\/Testbed.php:<br \/>\n&#8230;<br \/>\nprotected function execute(InputInterface $input, OutputInterface $output)<br \/>\n{<br \/>\n\/\/$output-&gt;writeln(&#8220;You did it!&#8221;);<br \/>\n$manager = $this-&gt;getObjectManager();<br \/>\n$object = $manager-&gt;create(&#8216;Pulsestorm\\TutorialObjectManager1\\Model\\Example&#8217;);<br \/>\n$output-&gt;writeln($object-&gt;getHelloMessage());<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>TEST THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-object-manager-1<br \/>\nHello Magento!<\/p>\n<p>SINGLETON<br \/>\nMODIFY AGAIN:<br \/>\n&#8230;<br \/>\nprotected function execute(InputInterface $input, OutputInterface $output)<br \/>\n{<br \/>\n\/\/$output-&gt;writeln(&#8220;You did it!&#8221;);<br \/>\n$manager = $this-&gt;getObjectManager();<br \/>\n\/*$object = $manager-&gt;create(&#8216;Pulsestorm\\TutorialObjectManager1\\Model\\Example&#8217;);<br \/>\n$output-&gt;writeln($object-&gt;getHelloMessage());*\/<\/p>\n<p>\/\/USE &#8216;GET&#8217; INSTEAD OF &#8216;CREATE&#8217; FOR SINGLETON<br \/>\n$object = $manager-&gt;get(&#8216;Pulsestorm\\TutorialObjectManager1\\Model\\Example&#8217;);<br \/>\n$object-&gt;message = &#8216;Hello PHP!&#8217;;<br \/>\n$output-&gt;writeln(<br \/>\n$object-&gt;getHelloMessage()<br \/>\n);<\/p>\n<p>$object = $manager-&gt;get(&#8216;Pulsestorm\\TutorialObjectManager1\\Model\\Example&#8217;);<br \/>\n$output-&gt;writeln(<br \/>\n$object-&gt;getHelloMessage()<br \/>\n);<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>RUN THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-object-manager-1<br \/>\nHello PHP!<br \/>\nHello PHP!<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2\u2019s Automatic Dependency Injection<br \/>\nhttps:\/\/alanstorm.com\/magento2_dependency_injection_2015\/<\/p>\n<p>DOWNLOAD FROM https:\/\/github.com\/astorm\/magento2-tutorial-objectmanager2<br \/>\nAND FOLLOW THE INSTRUCTION TO PUT IN IN \/app\/code\/Pulsestorm\/ DIR<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_TutorialObjectManager2<\/p>\n<p>RUN THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-object-manager-2<br \/>\nHello Again World!<\/p>\n<p>AUTOMATIC DEPENDENCY INJECTION<br \/>\nMODIFY &#8216;__construct&#8217; FUNCTION IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialObjectManager2\/Model\/Example.php:<br \/>\n&#8230;<br \/>\npublic function __construct(Message $message)<br \/>\n{<br \/>\n\/\/$object = new Message; \/\/<br \/>\n\/\/$this-&gt;messageObject = $object;<br \/>\n$this-&gt;messageObject = $message;<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>RUN THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-object-manager-2<br \/>\nHello Again World!<\/p>\n<p>SO NO NEED TO SUPPLY &#8216;message&#8217; PARAMETER BECAUSE IT&#8217;D ALREDY TAKE CARE BY AUTOMATIC DEPENDENCY INJECTION OF M2<br \/>\n&#8216;This is automatic dependency injection. Behind the scenes, the object manager will use PHP\u2019s reflection features to look at a class\u2019s __construct type hints\/parameters, automatically instantiate the object for us, and then pass it into the constructor as an argument.&#8217;<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2 Object Manager Preferences<br \/>\nhttps:\/\/alanstorm.com\/magento_2_object_manager_preferences\/<\/p>\n<p>DOWNLOAD FROM https:\/\/github.com\/astorm\/magento2-tutorial-objectpreference1<br \/>\nAND FOLLOW THE INSTRUCTION TO PUT IN IN \/app\/code\/Pulsestorm\/ DIR<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_TutorialObjectPreference<\/p>\n<p>RUN THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-object-preference<br \/>\nHello!<\/p>\n<p>CLASS PREFERENCE<br \/>\nSEE: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialObjectPreference\/etc\/di.xml<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2 Object Manager Argument Replacement<br \/>\nhttps:\/\/alanstorm.com\/magento_2_object_manager_argument_replacement\/<\/p>\n<p>DOWNLOAD FROM https:\/\/github.com\/astorm\/magento2-tutorial-objectmanager-arguments<br \/>\nAND FOLLOW THE INSTRUCTION TO PUT IN IN \/app\/code\/Pulsestorm\/ DIR<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_TutorialObjectManagerArguments<\/p>\n<p>RUN THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-object-manager-arguments<br \/>\nInstalled!<\/p>\n<p>ARGUMENT REPLACEMENT<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialObjectManagerArguments\/etc\/di.xml:<br \/>\n&#8230;<br \/>\n&lt;type name=&#8221;Magento\\Framework\\Console\\CommandList&#8221;&gt;<br \/>\n&#8230;<br \/>\n&lt;\/type&gt;<br \/>\n&lt;type name=&#8221;Pulsestorm\\TutorialObjectManagerArguments\\Model\\Example&#8221;&gt;<br \/>\n&lt;arguments&gt;<br \/>\n&lt;argument name=&#8221;scaler1&#8243; xsi:type=&#8221;string&#8221;&gt;bar&lt;\/argument&gt;<br \/>\n&lt;\/arguments&gt;<br \/>\n&lt;\/type&gt;<br \/>\n&#8230;<\/p>\n<p>RUN THE COMMAND: (CLEAR\/FLUSH CACHE FIRST)<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-object-manager-arguments<br \/>\n&#8230;<br \/>\nThe Property $scaler1<br \/>\nis a string<br \/>\nwith a value of: bar<br \/>\n&#8230;<\/p>\n<p>REPLACING ARRAYS<br \/>\nMODIFY AGAIN:<br \/>\n&#8230;<br \/>\n&lt;type name=&#8221;Pulsestorm\\TutorialObjectManagerArguments\\Model\\Example&#8221;&gt;<br \/>\n&lt;arguments&gt;<br \/>\n&lt;argument name=&#8221;scaler1&#8243; xsi:type=&#8221;string&#8221;&gt;bar&lt;\/argument&gt;<br \/>\n&lt;argument name=&#8221;thearray&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;item name=&#8221;0&#8243; xsi:type=&#8221;string&#8221;&gt;science&lt;\/item&gt;<br \/>\n&lt;item name=&#8221;baz&#8221; xsi:type=&#8221;string&#8221;&gt;baz&lt;\/item&gt;<br \/>\n&lt;item name=&#8221;bar&#8221; xsi:type=&#8221;string&#8221;&gt;bar&lt;\/item&gt;<br \/>\n&lt;\/argument&gt;<br \/>\n&lt;\/arguments&gt;<br \/>\n&lt;\/type&gt;<br \/>\n&#8230;<\/p>\n<p>RUN THE COMMAND: (CLEAR\/FLUSH CACHE FIRST)<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-object-manager-arguments<br \/>\n&#8230;<br \/>\nThe Property $thearray<br \/>\nis an array<br \/>\nwith the elements:<br \/>\n0=&gt;science<br \/>\nbaz=&gt;baz<br \/>\nbar=&gt;bar<\/p>\n<p>Magento 2 Object Manager Virtual Types<br \/>\nhttps:\/\/alanstorm.com\/magento_2_object_manager_virtual_types\/<\/p>\n<p>DOWNLOAD FROM https:\/\/github.com\/astorm\/magento2-tutorial-objectmanager-virtual-types<br \/>\nAND FOLLOW THE INSTRUCTION TO PUT IN IN \/app\/code\/Pulsestorm\/ DIR<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_TutorialVirtualType<\/p>\n<p>RUN THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-virtual-type<br \/>\nInstalled Pulsestorm_TutorialVirtualType!<\/p>\n<p>MODIFY &#8216;execute&#8217; FUNCTION IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialVirtualType\/Command\/Testbed.php:<br \/>\n&#8230;<br \/>\nprotected function execute(InputInterface $input, OutputInterface $output)<br \/>\n{<br \/>\n$this-&gt;output = $output;<br \/>\n\/\/$output-&gt;writeln(&#8220;Installed Pulsestorm_TutorialVirtualType!&#8221;);<br \/>\n$this-&gt;showNestedPropertiesForObject();<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>FLUSH THE CACHE AND RUN THE COMMAND AGAIN:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-virtual-type<br \/>\nFirst, we&#8217;ll report on the Pulsestorm\\TutorialVirtualType\\Model\\Example object<br \/>\nThe Property $property_of_example_object<br \/>\nis an object<br \/>\ncreated with the class:<br \/>\nPulsestorm\\TutorialVirtualType\\Model\\Argument1<\/p>\n<p>Next, we&#8217;re going to report on the Example object&#8217;s one property (an Argument1 class)<br \/>\nThe Property $property_of_argument1_object<br \/>\nis an object<br \/>\ncreated with the class:<br \/>\nPulsestorm\\TutorialVirtualType\\Model\\Argument2<\/p>\n<p>Finally, we&#8217;ll report on an Argument1 object, instantiated seperate from Example<br \/>\nThe Property $property_of_argument1_object<br \/>\nis an object<br \/>\ncreated with the class:<br \/>\nPulsestorm\\TutorialVirtualType\\Model\\Argument2<\/p>\n<p>Creating a Virtual Type<br \/>\nWith virtual types, the only behavior you can change in your virtual sub-class is which dependencies are injected.<br \/>\nWith virtual types, the only behavior you can change in your virtual sub-class is which dependencies are injected.<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialVirtualType\/etc\/di.xml:<br \/>\n&#8230;<br \/>\n&lt;virtualType name=&#8221;ourVirtualTypeName&#8221; type=&#8221;Pulsestorm\\TutorialVirtualType\\Model\\Argument1&#8243;&gt;<br \/>\n&lt;arguments&gt;<br \/>\n&lt;argument name=&#8221;the_argument&#8221; xsi:type=&#8221;object&#8221;&gt;Pulsestorm\\TutorialVirtualType\\Model\\Argument3&lt;\/argument&gt;<br \/>\n&lt;\/arguments&gt;<br \/>\n&lt;\/virtualType&gt;<\/p>\n<p>&lt;type name=&#8221;Pulsestorm\\TutorialVirtualType\\Model\\Example&#8221;&gt;<br \/>\n&lt;arguments&gt;<br \/>\n&lt;argument name=&#8221;the_object&#8221; xsi:type=&#8221;object&#8221;&gt;ourVirtualTypeName&lt;\/argument&gt;<br \/>\n&lt;\/arguments&gt;<br \/>\n&lt;\/type&gt;<br \/>\n&#8230;<\/p>\n<p>FLUSH THE CACHE AND RUN THE COMMAND AGAIN:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-virtual-type<br \/>\nFirst, we&#8217;ll report on the Pulsestorm\\TutorialVirtualType\\Model\\Example object<br \/>\nThe Property $property_of_example_object<br \/>\nis an object<br \/>\ncreated with the class:<br \/>\nPulsestorm\\TutorialVirtualType\\Model\\Argument1<\/p>\n<p>Next, we&#8217;re going to report on the Example object&#8217;s one property (an Argument1 class)<br \/>\nThe Property $property_of_argument1_object<br \/>\nis an object<br \/>\ncreated with the class:<br \/>\nPulsestorm\\TutorialVirtualType\\Model\\Argument3 &lt;&#8211; IT&#8217;S CHANGED BY VIRTUALTYPE<\/p>\n<p>Finally, we&#8217;ll report on an Argument1 object, instantiated seperate from Example<br \/>\nThe Property $property_of_argument1_object<br \/>\nis an object<br \/>\ncreated with the class:<br \/>\nPulsestorm\\TutorialVirtualType\\Model\\Argument2 &lt;&#8211; NOT CHANGED<\/p>\n<p>You\u2019ll notice that the property_of_argument1_object property is now an Argument3 object \u2014 but only when that parameter\u2019s owner class (Argument1) is instantiated by dependency injection in the Example class. When we instantiate Argument1 by itself \u2014 Magento does not inject a dependency.<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2 Object Manager: Proxy Objects<br \/>\nhttps:\/\/alanstorm.com\/magento_2_object_manager_proxy_objects\/<\/p>\n<p>DOWNLOAD FROM https:\/\/github.com\/astorm\/magento2-tutorial-proxy-objects<br \/>\nAND FOLLOW THE INSTRUCTION TO PUT IN IN \/app\/code\/Pulsestorm\/ DIR<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_TutorialProxy1<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_TutorialProxy2<\/p>\n<p>RUN A COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-proxy<br \/>\nYou&#8217;ve installed Pulsestorm_TutorialProxy2!<br \/>\nYou&#8217;ve also installed Pulsestorm_TutorialProxy1!<\/p>\n<p>MODIFY &#8216;execute&#8217; FUNCTION IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialProxy2\/Command\/Testbed.php:<br \/>\n&#8230;<br \/>\nprotected function execute(InputInterface $input, OutputInterface $output)<br \/>\n{<br \/>\n\/\/$this-&gt;installedCheck($output);<br \/>\n$service = $this-&gt;createService($output);<br \/>\n$this-&gt;sayHelloWithFastObject($service, $output);<br \/>\n$this-&gt;sayHelloWithSlowObject($service, $output);<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>RUN THE COMMAND AGAIN:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-proxy<br \/>\nAbout to Create Service<br \/>\nConstructing FastLoading Object<br \/>\nConstructing SlowLoading Object<br \/>\nCreated Service, approximate time to load: 3006.922 ms &lt;&#8211; SLOW<\/p>\n<p>About to say hello with fast object<br \/>\nHello<br \/>\nSaid hello with fast object, approximate time to load: 0.0188 ms<\/p>\n<p>About to say hello with slow object<br \/>\nHello<br \/>\nSaid hello with slow object, approximate time to load: 0.0551 ms<\/p>\n<p>TO REPLACE THE SLOW OBJECT IN TutorialProxy1 OBJECT, WE CAN&#8217;T USE PREFERENCE BUT PROXY. SO MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialProxy2\/etc\/di.xml:<br \/>\n&#8230;<br \/>\n&lt;!&#8211; Notice: we&#8217;re using `TutorialProxy2`&#8217;s di.xml to change the<br \/>\nbehavior of `TutorialProxy1`. This the far more common usage<br \/>\nof object manager\/dependency-injection than the examples in<br \/>\nour tutorial so far &#8211;&gt;<\/p>\n<p>&lt;type name=&#8221;Pulsestorm\\TutorialProxy1\\Model\\Example&#8221;&gt;<br \/>\n&lt;arguments&gt;<br \/>\n&lt;argument name=&#8221;slow&#8221; xsi:type=&#8221;object&#8221;&gt;Pulsestorm\\TutorialProxy1\\Model\\SlowLoading\\Proxy&lt;\/argument&gt;<br \/>\n&lt;\/arguments&gt;<br \/>\n&lt;\/type&gt;<\/p>\n<p>&lt;\/config&gt;<\/p>\n<p>THEN FLUSH THE CACHE AND RUN THE COMMAND AGAIN:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-proxy<br \/>\nAbout to Create Service<br \/>\nConstructing FastLoading Object<br \/>\nCreated Service, approximate time to load: 9.789 ms &lt;&#8211; MUCH FASTER FOR THE FIRST TIME<\/p>\n<p>About to say hello with fast object<br \/>\nHello<br \/>\nSaid hello with fast object, approximate time to load: 0.0129 ms<\/p>\n<p>About to say hello with slow object<br \/>\nConstructing SlowLoading Object<br \/>\nHello<br \/>\nSaid hello with slow object, approximate time to load: 3005.425 ms<\/p>\n<p>THEN RE-RUN:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-proxy<br \/>\nAbout to Create Service<br \/>\nConstructing FastLoading Object<br \/>\nCreated Service, approximate time to load: 1.6 ms &lt;&#8211; EVEN FASTER FOR THE 2nd TIME<\/p>\n<p>About to say hello with fast object<br \/>\nHello<br \/>\nSaid hello with fast object, approximate time to load: 0.0131 ms<\/p>\n<p>About to say hello with slow object<br \/>\nConstructing SlowLoading Object<br \/>\nHello<br \/>\nSaid hello with slow object, approximate time to load: 3000.463 ms<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2 Object Manager: Instance Objects<br \/>\nhttps:\/\/alanstorm.com\/magento_2_object_manager_instance_objects\/<\/p>\n<p>DOWNLOAD FROM https:\/\/github.com\/astorm\/magento2-tutorial-instance-objects<br \/>\nAND FOLLOW THE INSTRUCTION TO PUT IN IN \/app\/code\/Pulsestorm\/ DIR<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_TutorialInstanceObjects<\/p>\n<p>RUN A COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-instance-objects<br \/>\nYou&#8217;ve installed Pulsestorm_TutorialInstanceObjects<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2 Object Manager Plugin System<br \/>\nhttps:\/\/alanstorm.com\/magento_2_object_manager_plugin_system\/<\/p>\n<p>DOWNLOAD FROM https:\/\/github.com\/astorm\/magento2-tutorial-plugin<br \/>\nAND FOLLOW THE INSTRUCTION TO PUT IN IN \/app\/code\/Pulsestorm\/ DIR<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_TutorialPlugin<\/p>\n<p>RUN THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-plugin-installed<br \/>\nYou&#8217;ve installed Pulsestorm_TutorialPlugin<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-plugin<\/p>\n<p>We&#8217;re going to call the `getMessage` method on the class<\/p>\n<p>Pulsestorm\\TutorialPlugin\\Model\\Example<\/p>\n<p>Calling the real Pulsestorm\\TutorialPlugin\\Model\\Example::getMessage<br \/>\nResult: hello hola!<\/p>\n<p>CREATE A PLUGIN:<br \/>\nIt\u2019s inevitable that the larger community will start using the word \u201cplugin\u201d as a place-holder for \u201cextension\u201d or \u201cmodule\u201d, but in the language of the object manager, a \u201cplugin\u201d refers to a special class that\u2019s listening for any public method call to another object.<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialPlugin\/etc\/di.xml:<br \/>\n&#8230;<br \/>\n&lt;type name=&#8221;Pulsestorm\\TutorialPlugin\\Model\\Example&#8221;&gt;<br \/>\n&lt;plugin name=&#8221;pulsestorm_tutorial_plugin_model_example_plugin&#8221;<br \/>\ntype=&#8221;Pulsestorm\\TutorialPlugin\\Model\\Example\\Plugin&#8221;<br \/>\nsortOrder=&#8221;10&#8243;<br \/>\ndisabled=&#8221;false&#8221;\/&gt;<br \/>\n&lt;\/type&gt;<br \/>\n&#8230;<\/p>\n<p>CREATE A NEW EMPTY CLASS &#8216;Plugin&#8217; IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialPlugin\/Model\/Example\/Plugin.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\TutorialPlugin\\Model\\Example;<br \/>\nclass Plugin<br \/>\n{<\/p>\n<p>}<\/p>\n<p>FLUSH THE CACHE AND RE-RUN THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-plugin<\/p>\n<p>We&#8217;re going to call the `getMessage` method on the class<\/p>\n<p>Pulsestorm\\TutorialPlugin\\Model\\Example\\Interceptor &lt;&#8211; INTERCEPTOR ADDED FOR THE PLUGIN!!<\/p>\n<p>Calling the real Pulsestorm\\TutorialPlugin\\Model\\Example::getMessage<br \/>\nResult: hello hola!<\/p>\n<p>Plugins: After Methods<br \/>\nADD &#8216;afterGetMessage&#8217; FUNCTION IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialPlugin\/Model\/Example\/Plugin.php:<br \/>\n&#8230;<br \/>\npublic function afterGetMessage($subject, $result)<br \/>\n{<br \/>\necho &#8220;Calling &#8221; , __METHOD__,&#8221;\\n&#8221;;<br \/>\nreturn $result;<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>RE-RUN THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-plugin<\/p>\n<p>We&#8217;re going to call the `getMessage` method on the class<\/p>\n<p>Pulsestorm\\TutorialPlugin\\Model\\Example\\Interceptor<\/p>\n<p>Calling the real Pulsestorm\\TutorialPlugin\\Model\\Example::getMessage<br \/>\nCalling Pulsestorm\\TutorialPlugin\\Model\\Example\\Plugin::afterGetMessage<br \/>\nResult: hello hola!<\/p>\n<p>Plugins: Before Methods<br \/>\nADD &#8216;beforeGetMessage&#8217; FUNCTION IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialPlugin\/Model\/Example\/Plugin.php:<br \/>\n&#8230;<br \/>\npublic function beforeGetMessage($subject, $thing=&#8217;World&#8217;, $should_lc=false)<br \/>\n{<br \/>\necho &#8220;Calling &#8221; . __METHOD__,&#8221;\\n&#8221;;<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>RE-RUN THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-plugin<\/p>\n<p>We&#8217;re going to call the `getMessage` method on the class<\/p>\n<p>Pulsestorm\\TutorialPlugin\\Model\\Example\\Interceptor<\/p>\n<p>Calling Pulsestorm\\TutorialPlugin\\Model\\Example\\Plugin::beforeGetMessage<br \/>\nCalling the real Pulsestorm\\TutorialPlugin\\Model\\Example::getMessage<br \/>\nResult: hello hola!<\/p>\n<p>&#8230;<br \/>\npublic function beforeGetMessage($subject, $thing=&#8217;World&#8217;, $should_lc=false)<br \/>\n{<br \/>\n\/\/echo &#8220;Calling &#8221; . __METHOD__,&#8221;\\n&#8221;;<br \/>\nreturn [&#8216;Changing the argument&#8217;, $should_lc];<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-plugin<\/p>\n<p>We&#8217;re going to call the `getMessage` method on the class<\/p>\n<p>Pulsestorm\\TutorialPlugin\\Model\\Example\\Interceptor<\/p>\n<p>Calling the real Pulsestorm\\TutorialPlugin\\Model\\Example::getMessage<br \/>\nResult: hello changing the argument!<\/p>\n<p>Plugins: Around Methods<br \/>\nMODIFY<br \/>\n&#8230;<br \/>\npublic function aroundGetMessage($subject, $procede, $thing=&#8217;World&#8217;, $should_lc=false)<br \/>\n{<br \/>\necho &#8216;Calling&#8217; . __METHOD__ . &#8216; &#8212; before&#8217;,&#8221;\\n&#8221;;<br \/>\n$result = $procede();<br \/>\necho &#8216;Calling&#8217; . __METHOD__ . &#8216; &#8212; after&#8217;,&#8221;\\n&#8221;;<br \/>\nreturn $result;<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-plugin<\/p>\n<p>We&#8217;re going to call the `getMessage` method on the class<\/p>\n<p>Pulsestorm\\TutorialPlugin\\Model\\Example\\Interceptor<\/p>\n<p>CallingPulsestorm\\TutorialPlugin\\Model\\Example\\Plugin::aroundGetMessage &#8212; before<br \/>\nCalling the real Pulsestorm\\TutorialPlugin\\Model\\Example::getMessage<br \/>\nCallingPulsestorm\\TutorialPlugin\\Model\\Example\\Plugin::aroundGetMessage &#8212; after<br \/>\nResult: Hello World!<\/p>\n<p>AVOID PLUGIN CONFLICT FOR SAME FUNCTION\/METHOD NAME<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/TutorialPlugin\/etc\/di.xml:<br \/>\n&#8230;<br \/>\n&lt;!&#8211; START: two new plugins &#8211;&gt;<br \/>\n&lt;type name=&#8221;Pulsestorm\\TutorialPlugin\\Model\\Example&#8221;&gt;<br \/>\n&lt;plugin name=&#8221;pulsestorm_tutorial_plugin_model_conflict_plugin1&#8243;<br \/>\ntype=&#8221;Pulsestorm\\TutorialPlugin\\Model\\Conflict\\Plugin1&#8243;<br \/>\nsortOrder=&#8221;10&#8243;<br \/>\ndisabled=&#8221;false&#8221;\/&gt;<br \/>\n&lt;\/type&gt;<\/p>\n<p>&lt;type name=&#8221;Pulsestorm\\TutorialPlugin\\Model\\Example&#8221;&gt;<br \/>\n&lt;plugin name=&#8221;pulsestorm_tutorial_plugin_model_conflict_plugin2&#8243;<br \/>\ntype=&#8221;Pulsestorm\\TutorialPlugin\\Model\\Conflict\\Plugin2&#8243;<br \/>\nsortOrder=&#8221;15&#8243;<br \/>\ndisabled=&#8221;false&#8221;\/&gt;<br \/>\n&lt;\/type&gt;<br \/>\n&lt;!&#8211; START: two new plugins &#8211;&gt;<br \/>\n&#8230;<\/p>\n<p>RE-RUN THE COMMAND:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento ps:tutorial-plugin<\/p>\n<p>We&#8217;re going to call the `getMessage` method on the class<\/p>\n<p>Pulsestorm\\TutorialPlugin\\Model\\Example\\Interceptor<\/p>\n<p>CallingPulsestorm\\TutorialPlugin\\Model\\Example\\Plugin::aroundGetMessage &#8212; before<br \/>\nCalling the real Pulsestorm\\TutorialPlugin\\Model\\Example::getMessage<br \/>\nCalling Pulsestorm\\TutorialPlugin\\Model\\Conflict\\Plugin1::afterGetMessage<br \/>\nCalling Pulsestorm\\TutorialPlugin\\Model\\Conflict\\Plugin2::afterGetMessage<br \/>\nCallingPulsestorm\\TutorialPlugin\\Model\\Example\\Plugin::aroundGetMessage &#8212; after<br \/>\nResult: From Plugin 2<\/p>\n<p>Magento 2: Introducing UI Components<br \/>\nhttps:\/\/alanstorm.com\/magento_2_introducing_ui_components\/<\/p>\n<p>Satrias-MacBook-Pro:magentoce215 teddy$ php pestle.phar magento2:generate:ui:grid<br \/>\nWhich Module? (Pulsestorm_Gridexample)] Pulsestorm_ToDoCrud<br \/>\nCreate a unique ID for your Listing\/Grid! (pulsestorm_gridexample_log)] pulsestorm_todo_listing<br \/>\nWhat Resource Collection Model should your listing use? (Magento\\Cms\\Model\\ResourceModel\\Page\\Collection)] Pulsestorm\\ToDoCrud\\Model\\ResourceModel\\TodoItem\\Collection<br \/>\nWhat&#8217;s the ID field for you model? (pulsestorm_gridexample_log_id)] pulsestorm_todocrud_todoitem_id<br \/>\nCreating New \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/view\/adminhtml\/ui_component\/pulsestorm_todo_listing.xml<br \/>\nCreating: Pulsestorm\\ToDoCrud\\Ui\\Component\\Listing\\DataProviders\\Pulsestorm\\Todo\\Listing<br \/>\nCreating: Pulsestorm\\ToDoCrud\\Ui\\Component\\Listing\\Column\\Pulsestormtodolisting\\PageActions<br \/>\nDon&#8217;t forget to add this to your layout XML with &lt;uiComponent name=&#8221;pulsestorm_todo_listing&#8221;\/&gt;<\/p>\n<p>ADD A NEW FILE: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/view\/adminhtml\/layout\/pulsestorm_admin_todocrud_index_index.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;page xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd&#8221;&gt;<br \/>\n&lt;body&gt;<br \/>\n&lt;referenceBlock name=&#8221;content&#8221;&gt;<br \/>\n&lt;uiComponent name=&#8221;pulsestorm_todo_listing&#8221;\/&gt;<br \/>\n&lt;\/referenceBlock&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/page&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/ToDoCrud\/view\/adminhtml\/ui_component\/pulsestorm_todo_listing.xml:<br \/>\n&#8230;<br \/>\n&lt;column name=&#8221;pulsestorm_todocrud_todoitem_id&#8221;&gt;<br \/>\n&#8230;<br \/>\n&lt;\/column&gt;<br \/>\n&lt;column name=&#8221;title&#8221;&gt;<br \/>\n&lt;argument name=&#8221;data&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;item name=&#8221;config&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;item name=&#8221;filter&#8221; xsi:type=&#8221;string&#8221;&gt;text&lt;\/item&gt;<br \/>\n&lt;item name=&#8221;label&#8221; xsi:type=&#8221;string&#8221; translate=&#8221;true&#8221;&gt;Item Title&lt;\/item&gt;<br \/>\n&lt;item name=&#8221;sortOrder&#8221; xsi:type=&#8221;number&#8221;&gt;20&lt;\/item&gt;<br \/>\n&lt;\/item&gt;<br \/>\n&lt;\/argument&gt;<br \/>\n&lt;\/column&gt;<br \/>\n&lt;actionsColumn name=&#8221;actions&#8221; &#8230;<\/p>\n<p>Magento 2: Simplest UI Component<br \/>\nhttps:\/\/alanstorm.com\/magento_simplest_ui_component\/<\/p>\n<p>CREATE THE MODULE:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php pestle.phar generate_module Pulsestorm SimpleUiComponent 0.0.1<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/etc\/module.xml<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/registration.php<\/p>\n<p>CREATE ACL:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php pestle.phar generate_acl Pulsestorm_SimpleUiComponent Pulsestorm_SimpleUiComponent::top,Pulsestorm_SimpleUiComponent::menu_1<br \/>\nCreated \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/etc\/acl.xml<\/p>\n<p>CREATE MENU:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php pestle.phar generate_menu Pulsestorm_SimpleUiComponent Magento_Backend::system_other_settings Pulsestorm_SimpleUiComponent::a_menu_item Pulsestorm_SimpleUiComponent::menu_1 &#8220;Hello Simple Ui Component&#8221; pulsestorm_simpleuicomponent\/index\/index 1<br \/>\nWriting: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/etc\/adminhtml\/menu.xml<br \/>\nDone.<\/p>\n<p>CREATE ROUTE:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php pestle.phar generate_route Pulsestorm_SimpleUiComponent adminhtml pulsestorm_simpleuicomponent<br \/>\nController name? (Index)]<br \/>\nAction name? (Index)]<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/etc\/adminhtml\/routes.xml<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/Controller\/Adminhtml\/Index\/Index.php<br \/>\nDon&#8217;t forget your menu.xml and acl.xml<br \/>\naction=&#8221;pulsestorm_simpleuicomponent\/index\/index&#8221;<br \/>\nid=&#8221;Pulsestorm_SimpleUiComponent::pulsestorm_simpleuicomponent_menu<\/p>\n<p>CREATE VIEW:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php pestle.phar generate_view Pulsestorm_SimpleUiComponent adminhtml pulsestorm_simpleuicomponent_index_index Main content.phtml 1column<br \/>\nCreating \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/templates\/content.phtml<br \/>\nCreating: Pulsestorm\\SimpleUiComponent\\Block\\Adminhtml\\Main<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/layout\/pulsestorm_simpleuicomponent_index_index.xml<\/p>\n<p>ENABLE THE MODULE:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_SimpleUiComponent &amp;&amp; php bin\/magento setup:upgrade<\/p>\n<p>After running the above commands, you should be able to navigate to Magento\u2019s backend and click on the System -&gt; Other Settings -&gt; Hello Simple Ui Component menu to bring up our new backend section.<\/p>\n<p>MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/layout\/pulsestorm_simpleuicomponent_index_index.xml:<br \/>\n&#8230;<br \/>\n&lt;referenceBlock name=&#8221;content&#8221;&gt;<br \/>\n&lt;block template=&#8221;content.phtml&#8221; &#8230;\/&gt;<\/p>\n<p>&lt;!&#8211; START: our new ui component &#8211;&gt;<br \/>\n&lt;uiComponent name=&#8221;pulsestorm_simple&#8221;\/&gt;<br \/>\n&lt;!&#8211; END: our new ui component &#8211;&gt;<br \/>\n&lt;\/referenceBlock&gt;<br \/>\n&#8230;<\/p>\n<p>CREATE A NEW FILE IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/ui_component\/pulsestorm_simple.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;pulsestorm_simple xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:module:Magento_Ui:etc\/ui_configuration.xsd&#8221;&gt;<br \/>\n&lt;\/pulsestorm_simple&gt;<\/p>\n<p>THEN CREATE A NEW FILE &#8216;definition.xml&#8217; IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/base\/ui_component\/etc\/definition.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;components xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:module:Magento_Ui:etc\/ui_definition.xsd&#8221;&gt;<br \/>\n&lt;pulsestorm_simple class=&#8221;Pulsestorm\\SimpleUiComponent\\Component\\Simple&#8221;\/&gt;<br \/>\n&lt;\/components&gt;<\/p>\n<p>HERE WE NEED TO ADD CLASS PREFERENCE. SO CREATE &#8216;di.xml&#8217; FILE IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/etc\/di.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;config xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:framework:ObjectManager\/etc\/config.xsd&#8221;&gt;<br \/>\n&lt;preference for=&#8221;Magento\\Framework\\App\\Arguments\\ValidationState&#8221; type=&#8221;Pulsestorm\\SimpleUiComponent\\Model\\ValidationState&#8221;\/&gt;<br \/>\n&lt;\/config&gt;<\/p>\n<p>THEN CREATE A NEW PHP FILE IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/Model\/ValidationState.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\SimpleUiComponent\\Model;<br \/>\nclass ValidationState extends \\Magento\\Framework\\App\\Arguments\\ValidationState<br \/>\n{<br \/>\npublic function isValidationRequired()<br \/>\n{<br \/>\nreturn false;<br \/>\n}<br \/>\n}<\/p>\n<p>THEN CREATE ANOTHER NEW PHP FILE IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/Component\/Simple.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\SimpleUiComponent\\Component;<br \/>\nclass Simple extends \\Magento\\Ui\\Component\\AbstractComponent<br \/>\n{<br \/>\nconst NAME = &#8216;pulsestorm_simple&#8217;;<br \/>\npublic function getComponentName()<br \/>\n{<br \/>\nreturn static::NAME;<br \/>\n}<br \/>\n}<\/p>\n<p>THEN MODIFY &#8216;definition.xml&#8217; LIKE THIS:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;components xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:module:Magento_Ui:etc\/ui_definition.xsd&#8221;&gt;<br \/>\n&lt;pulsestorm_simple class=&#8221;Pulsestorm\\SimpleUiComponent\\Component\\Simple&#8221;&gt;<br \/>\n&lt;argument name=&#8221;data&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;item name=&#8221;template&#8221; xsi:type=&#8221;string&#8221;&gt;templates\/our-template&lt;\/item&gt;<br \/>\n&lt;\/argument&gt;<br \/>\n&lt;\/pulsestorm_simple&gt;<br \/>\n&lt;\/components&gt;<\/p>\n<p>THEN CREATE A NEW XHTML FILE IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/ui_component\/templates\/our-template.xhtml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br \/>\n&lt;div&gt;<br \/>\n&lt;h1&gt;Hello World&lt;\/h1&gt;<br \/>\n&lt;\/div&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>THEN MODIFY &#8216;pulsestorm_simple.xml&#8217; FILE:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;pulsestorm_simple xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:module:Magento_Ui:etc\/ui_configuration.xsd&#8221;&gt;<\/p>\n<p>&lt;dataSource name=&#8221;pulsestorm_simple_data_source&#8221;&gt;<br \/>\n&lt;argument name=&#8221;dataProvider&#8221; xsi:type=&#8221;configurableObject&#8221;&gt;<br \/>\n&lt;!&#8211; the PHP class that implements a data provider &#8211;&gt;<br \/>\n&lt;argument name=&#8221;class&#8221; xsi:type=&#8221;string&#8221;&gt;Pulsestorm\\SimpleUiComponent\\Model\\DataProvider&lt;\/argument&gt;<\/p>\n<p>&lt;!&#8211; redundant with the `dataSource` name &#8211;&gt;<br \/>\n&lt;argument name=&#8221;name&#8221; xsi:type=&#8221;string&#8221;&gt;pulsestorm_simple_data_source&lt;\/argument&gt;<\/p>\n<p>&lt;!&#8211; required: means ui components are meant to work with models &#8211;&gt;<br \/>\n&lt;argument name=&#8221;primaryFieldName&#8221; xsi:type=&#8221;string&#8221;&gt;entity_id&lt;\/argument&gt;<\/p>\n<p>&lt;!&#8211; required: means ui components are meant to work with URL passing &#8211;&gt;<br \/>\n&lt;argument name=&#8221;requestFieldName&#8221; xsi:type=&#8221;string&#8221;&gt;id&lt;\/argument&gt;<br \/>\n&lt;\/argument&gt;<\/p>\n<p>&lt;\/dataSource&gt;<\/p>\n<p>&lt;\/pulsestorm_simple&gt;<\/p>\n<p>THEN ADD A NEW PHP FILE (DATA PROVIDER) IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/Model\/DataProvider.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\SimpleUiComponent\\Model;<br \/>\nclass DataProvider extends \\Magento\\Ui\\DataProvider\\AbstractDataProvider<br \/>\n{<br \/>\n}<\/p>\n<p>OK. CLEAR THE CACHE THEN TEST IT ON THE ADMIN PAGE (SYSTEM -&gt; HELLO SIMPLE UI COMPONENT).<br \/>\nIT SHOULD DIPLAY:<br \/>\nMagento Admin<br \/>\nThis is my template, there are many like it, but this one is mine.<br \/>\nHello World<\/p>\n<p>&nbsp;<\/p>\n<p>MODIFYING XHTML TEMPLATE.<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/Component\/Simple.php TO ADD NEW FUNCTION &#8216;getEvenMoreData&#8217;:<br \/>\n&#8230;<br \/>\n\/\/added this method<br \/>\npublic function getEvenMoreData()<br \/>\n{<br \/>\nreturn &#8216;Even More Data!&#8217;;<br \/>\n}<br \/>\n&#8230;<\/p>\n<p>THEN CALL THE FUNCTION FROM \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/ui_component\/templates\/our-template.xhtml:<br \/>\n&#8230;<br \/>\n&lt;p&gt;<br \/>\n{{getComponentName()}}<br \/>\n&lt;\/p&gt;<\/p>\n<p>&lt;p&gt;<br \/>\n{{getEvenMoreData()}}<br \/>\n&lt;\/p&gt;<br \/>\n&#8230;<\/p>\n<p>OK. CLEAR THE CACHE THEN TEST IT ON THE ADMIN PAGE (SYSTEM -&gt; HELLO SIMPLE UI COMPONENT).<br \/>\nIT SHOULD DIPLAY:<br \/>\nMagento Admin<br \/>\nThis is my template, there are many like it, but this one is mine.<br \/>\nHello World<br \/>\npulsestorm_simple<br \/>\nEven More Data!<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2: Simplest UI Knockout Component<br \/>\nhttps:\/\/alanstorm.com\/magento_2_simplest_ui_knockout_component\/<\/p>\n<p>MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/base\/ui_component\/etc\/definition.xml:<br \/>\n&#8230;<br \/>\n&lt;argument name=&#8221;data&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&#8230;<br \/>\n&lt;item name=&#8221;config&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;item name=&#8221;component&#8221; xsi:type=&#8221;string&#8221;&gt;Pulsestorm_SimpleUiComponent\/js\/pulsestorm_simple_component&lt;\/item&gt;<br \/>\n&lt;\/item&gt;<br \/>\n&lt;\/argument&gt;<br \/>\n&#8230;.<\/p>\n<p>CREATE A NEW JS FILE IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/web\/js\/pulsestorm_simple_component.js:<br \/>\n\/*define([], function(){<br \/>\nconsole.log(&#8216;Called&#8217;);<br \/>\n});*\/<br \/>\ndefine([&#8216;uiElement&#8217;], function(Element){<br \/>\nconsole.log(&#8216;Called&#8217;);<br \/>\nviewModelConstructor = Element.extend({<br \/>\ndefaults: {<br \/>\ntemplate: &#8216;Pulsestorm_SimpleUiComponent\/pulsestorm_simple_template&#8217;<br \/>\n}<br \/>\n});<\/p>\n<p>return viewModelConstructor;<br \/>\n});<\/p>\n<p>\/\/IT&#8217;D PRINT &#8216;Called&#8217;.<\/p>\n<p>CREATE THE HTML TEMPLATE IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/web\/template\/pulsestorm_simple_template.html:<br \/>\n&lt;h1&gt;Rendered with Knockout.js&lt;\/h1&gt;<\/p>\n<p>MODIFY THE XHTML COMPONENT IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/ui_component\/templates\/our-template.xhtml:<br \/>\n&#8230;<br \/>\n&lt;div&gt;<br \/>\n&#8230;<\/p>\n<p>&lt;div data-bind=&#8221;scope: &#8216;pulsestorm_simple.pulsestorm_simple'&#8221; class=&#8221;entry-edit form-inline&#8221;&gt;<br \/>\n&lt;!&#8211; ko template: getTemplate() &#8211;&gt;&lt;!&#8211; \/ko &#8211;&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<\/p>\n<p>OK. CLEAR THE CACHE AND RELOAD:<br \/>\nIT&#8217;D PRINT<br \/>\nMagento Admin<\/p>\n<p>This is my template, there are many like it, but this one is mine.<br \/>\nHello World<br \/>\npulsestorm_simple<\/p>\n<p>Even More Data!<\/p>\n<p>{{message}}<\/p>\n<p>Rendered with Knockout.js<\/p>\n<p>NOTE: &#8216;pulsestorm_simple.pulsestorm_simple&#8217; IS FROM THE UICOMPONENT NAME (\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/ui_component\/pulsestorm_simple.xml)<\/p>\n<p>TO SHOW A MESSAGE IN THE HTML FILE (pulsestorm_simple_template.html), MODIFY THE COMPONENT (\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/web\/js\/pulsestorm_simple_component.js) LIKE THIS:<br \/>\ndefine([&#8216;uiElement&#8217;, &#8216;ko&#8217;], function(Element, ko){<br \/>\nconsole.log(&#8216;Called&#8217;);<br \/>\nviewModelConstructor = Element.extend({<br \/>\ndefaults: {<br \/>\ntemplate: &#8216;Pulsestorm_SimpleUiComponent\/pulsestorm_simple_template&#8217;<br \/>\n},<br \/>\nmessage: ko.observable(&#8220;Hello Knockout.js!&#8221;)<br \/>\n});<\/p>\n<p>return viewModelConstructor;<br \/>\n});<\/p>\n<p>THEN IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/web\/template\/pulsestorm_simple_template.html:<br \/>\n&lt;h1&gt;Rendered with Knockout.js&lt;\/h1&gt;<\/p>\n<p>&lt;strong data-bind=&#8221;text:message&#8221;&gt;&lt;\/strong&gt;<\/p>\n<p>CLEAR THE CACHE AND RELOAD.<\/p>\n<p>HERE IS ANOTHER WAY TO RENDER THE TEMPLATE<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/base\/ui_component\/etc\/definition.xml:<br \/>\n&#8230;<br \/>\n&lt;item name=&#8221;config&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;!&#8211; &lt;item name=&#8221;component&#8221; xsi:type=&#8221;string&#8221;&gt;Pulsestorm_SimpleUiComponent\/js\/pulsestorm_simple_component&lt;\/item&gt; &#8211;&gt;<br \/>\n&lt;item name=&#8221;component&#8221; xsi:type=&#8221;string&#8221;&gt;uiComponent&lt;\/item&gt;<br \/>\n&lt;\/item&gt;<br \/>\n&#8230;<\/p>\n<p>THEN MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleUiComponent\/view\/adminhtml\/ui_component\/pulsestorm_simple.xml AND ADD:<br \/>\n&#8230;<br \/>\n&lt;pulsestorm_simple xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:module:Magento_Ui:etc\/ui_configuration.xsd&#8221;&gt;<\/p>\n<p>&lt;dataSource name=&#8221;pulsestorm_simple_data_source&#8221;&gt;<br \/>\n&#8230;<\/p>\n<p>&lt;\/dataSource&gt;<\/p>\n<p>&lt;htmlContent name=&#8221;first_ever_child&#8221;&gt;<br \/>\n&lt;argument name=&#8221;block&#8221; xsi:type=&#8221;object&#8221;&gt;Magento\\Framework\\View\\Element\\Text&lt;\/argument&gt;<br \/>\n&lt;argument name=&#8221;data&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;item name=&#8221;config&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;item name=&#8221;component&#8221; xsi:type=&#8221;string&#8221;&gt;Pulsestorm_SimpleUiComponent\/js\/pulsestorm_simple_component&lt;\/item&gt;<br \/>\n&lt;\/item&gt;<br \/>\n&lt;\/argument&gt;<br \/>\n&lt;\/htmlContent&gt;<\/p>\n<p>&lt;\/pulsestorm_simple&gt;<\/p>\n<p>THEN CLEAR CACHE AND RELOAD. IT&#8217;D PRINT THE SAME! BUT IF I MODIFY THE ABOVE XML FILE FURTHER, LIKE THIS (ADD &#8220;second_ever_child&#8221;):<br \/>\n&#8230;<br \/>\n&lt;htmlContent name=&#8221;first_ever_child&#8221;&gt;<br \/>\n&#8230;<br \/>\n&lt;\/htmlContent&gt;<\/p>\n<p>&lt;htmlContent name=&#8221;second_ever_child&#8221;&gt;<br \/>\n&lt;argument name=&#8221;block&#8221; xsi:type=&#8221;object&#8221;&gt;Magento\\Framework\\View\\Element\\Text&lt;\/argument&gt;<br \/>\n&lt;argument name=&#8221;data&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;item name=&#8221;config&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;item name=&#8221;component&#8221; xsi:type=&#8221;string&#8221;&gt;Pulsestorm_SimpleUiComponent\/js\/pulsestorm_simple_component&lt;\/item&gt;<br \/>\n&lt;\/item&gt;<br \/>\n&lt;\/argument&gt;<br \/>\n&lt;\/htmlContent&gt;<br \/>\n&#8230;<\/p>\n<p>THE TEMPLATE WOULD BE RENDERED TWICE!<\/p>\n<p>&nbsp;<\/p>\n<p>Magento 2: Simplest XSD Valid UI Component<br \/>\nhttps:\/\/alanstorm.com\/magento_2_simplest_xsd_valid_ui_component\/<\/p>\n<p>DISABLE THE SIMPLEUICOMPONENT FIRST:<br \/>\nphp bin\/magento module:disable Pulsestorm_SimpleUiComponent<\/p>\n<p>CREATE A NE MODULE:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php pestle.phar generate_module Pulsestorm SimpleValidUiComponent 0.0.1<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/etc\/module.xml<br \/>\nCreated: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/registration.php<\/p>\n<p>CREATE ACL:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php pestle.phar generate_acl Pulsestorm_SimpleValidUiComponent Pulsestorm_SimpleValidUiComponent::top,Pulsestorm_SimpleValidUiComponent::menu_1<br \/>\nCreated \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/etc\/acl.xml<\/p>\n<p>CREATE A MENU:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php pestle.phar generate_menu Pulsestorm_SimpleValidUiComponent Magento_Backend::system_other_settings Pulsestorm_SimpleValidUiComponent::a_menu_item Pulsestorm_SimpleValidUiComponent::menu_1 &#8220;Hello Simple Valid Ui Component&#8221; pulsestorm_simplevaliduicomponent\/index\/index 1<br \/>\nWriting: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/etc\/adminhtml\/menu.xml<br \/>\nDone.<\/p>\n<p>CREATE A ROUTE:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php pestle.phar generate_route Pulsestorm_SimpleValidUiComponent adminhtml pulsestorm_simplevaliduicomponent<br \/>\nController name? (Index)]<br \/>\nAction name? (Index)]<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/etc\/adminhtml\/routes.xml<br \/>\n\/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/Controller\/Adminhtml\/Index\/Index.php<br \/>\nDon&#8217;t forget your menu.xml and acl.xml<br \/>\naction=&#8221;pulsestorm_simplevaliduicomponent\/index\/index&#8221;<br \/>\nid=&#8221;Pulsestorm_SimpleValidUiComponent::pulsestorm_simplevaliduicomponent_menu<\/p>\n<p>CREATE VIEW:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php pestle.phar generate_view Pulsestorm_SimpleValidUiComponent adminhtml pulsestorm_simplevaliduicomponent_index_index Main content.phtml 1column<br \/>\nCreating \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/view\/adminhtml\/templates\/content.phtml<br \/>\nCreating: Pulsestorm\\SimpleValidUiComponent\\Block\\Adminhtml\\Main<br \/>\nCreating: \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/view\/adminhtml\/layout\/pulsestorm_simplevaliduicomponent_index_index.xml<\/p>\n<p>ENABLE THE MODULE:<br \/>\nSatrias-MacBook-Pro:magentoce215 teddy$ php bin\/magento module:enable Pulsestorm_SimpleValidUiComponent &amp;&amp; php bin\/magento setup:upgrade<\/p>\n<p>With the above in place, clear your cache, and you should be able to navigate to a System -&gt; Other Settings -&gt; Hello Simple Valid Ui Component menu in your Magento backend.<\/p>\n<p>CLEAR THE CACHE AND RELOAD<\/p>\n<p>MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/view\/adminhtml\/layout\/pulsestorm_simplevaliduicomponent_index_index.xml TO ADD &#8216;uiComponent&#8217;:<br \/>\n&#8230;<br \/>\n&lt;referenceBlock name=&#8221;content&#8221;&gt;<br \/>\n&lt;block template=&#8221;content.phtml&#8221; class=&#8221;Pulsestorm\\SimpleValidUiComponent\\Block\\Adminhtml\\Main&#8221; name=&#8221;pulsestorm_simplevaliduicomponent_block_main&#8221;\/&gt;<\/p>\n<p>&lt;uiComponent name=&#8221;pulsestorm_simple_valid&#8221;\/&gt;<\/p>\n<p>&lt;\/referenceBlock&gt;<br \/>\n&#8230;.<\/p>\n<p>then we\u2019ll create an XML file for this named UI Component IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/view\/adminhtml\/ui_component\/pulsestorm_simple_valid.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243;?&gt;<br \/>\n&lt;pulsestorm_simple_valid xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:module:Magento_Ui:etc\/ui_configuration.xsd&#8221;&gt;<br \/>\n&lt;\/pulsestorm_simple_valid&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>MODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/view\/adminhtml\/ui_component\/pulsestorm_simple_valid.xml:<br \/>\n&lt;container xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:module:Magento_Ui:etc\/ui_configuration.xsd&#8221;&gt;<br \/>\n&lt;\/container&gt;<\/p>\n<p>MODIFY AGAIN TO ADD &#8216;dataSource&#8217; NODE:<br \/>\n&lt;container xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:module:Magento_Ui:etc\/ui_configuration.xsd&#8221;&gt;<br \/>\n&lt;dataSource name=&#8221;pulsestorm_simple_valid_data_source&#8221;&gt;<br \/>\n&lt;argument name=&#8221;dataProvider&#8221; xsi:type=&#8221;configurableObject&#8221;&gt;<br \/>\n&lt;!&#8211; the PHP class that implements a data provider &#8211;&gt;<br \/>\n&lt;argument name=&#8221;class&#8221; xsi:type=&#8221;string&#8221;&gt;Pulsestorm\\SimpleValidUiComponent\\Model\\DataProvider&lt;\/argument&gt;<\/p>\n<p>&lt;!&#8211; redundant with the `dataSource` name &#8211;&gt;<br \/>\n&lt;argument name=&#8221;name&#8221; xsi:type=&#8221;string&#8221;&gt;pulsestorm_simple_valid_data_source&lt;\/argument&gt;<\/p>\n<p>&lt;!&#8211; required: means ui components are meant to work with models &#8211;&gt;<br \/>\n&lt;argument name=&#8221;primaryFieldName&#8221; xsi:type=&#8221;string&#8221;&gt;entity_id&lt;\/argument&gt;<\/p>\n<p>&lt;!&#8211; required: means ui components are meant to work with URL passing &#8211;&gt;<br \/>\n&lt;argument name=&#8221;requestFieldName&#8221; xsi:type=&#8221;string&#8221;&gt;id&lt;\/argument&gt;<br \/>\n&lt;\/argument&gt;<br \/>\n&lt;\/dataSource&gt;<br \/>\n&lt;\/container&gt;<\/p>\n<p>THEN add a new data provider class IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/Model\/DataProvider.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\SimpleValidUiComponent\\Model;<br \/>\nclass DataProvider extends \\Magento\\Ui\\DataProvider\\AbstractDataProvider<br \/>\n{<br \/>\n}<\/p>\n<p>THEN CLEAR THE CACHE AND RELOAD<\/p>\n<p>CHANGING TEMPLATE<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/view\/adminhtml\/ui_component\/pulsestorm_simple_valid.xml:<br \/>\n&lt;container xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:module:Magento_Ui:etc\/ui_configuration.xsd&#8221;&gt;<br \/>\n&lt;argument name=&#8221;data&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;item name=&#8221;template&#8221; xsi:type=&#8221;string&#8221;&gt;templates\/pulsestorm_simple_valid\/default&lt;\/item&gt;<br \/>\n&lt;\/argument&gt;<\/p>\n<p>&lt;dataSource name=&#8221;pulsestorm_simple_valid_data_source&#8221;&gt;<br \/>\n&#8230;<br \/>\n&lt;\/dataSource&gt;<br \/>\n&lt;\/container&gt;<\/p>\n<p>THEN CREATE A XHTML FILE IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/view\/adminhtml\/ui_component\/templates\/pulsestorm_simple_valid\/default.xhtml:<br \/>\n&lt;div<br \/>\ndata-bind=&#8221;scope: &#8216;{{getName()}}.{{getName()}}'&#8221;<br \/>\nxmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221;<br \/>\nxsi:noNamespaceSchemaLocation=&#8221;..\/..\/..\/..\/..\/..\/Ui\/etc\/ui_template.xsd&#8221;&gt;<\/p>\n<p>&lt;!&#8211; ko template: getTemplate() &#8211;&gt;&lt;!&#8211; \/ko &#8211;&gt;<br \/>\n&lt;\/div&gt;<\/p>\n<p>ADD an htmlContent component\/node IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/view\/adminhtml\/ui_component\/pulsestorm_simple_valid.xml:<br \/>\n&lt;container &#8230;&gt;<br \/>\n&#8230;<\/p>\n<p>&lt;htmlContent name=&#8221;our_first_content&#8221;&gt;<br \/>\n&lt;argument name=&#8221;block&#8221; xsi:type=&#8221;object&#8221;&gt;Pulsestorm\\SimpleValidUiComponent\\Block\\Example&lt;\/argument&gt;<br \/>\n&lt;\/htmlContent&gt;<br \/>\n&lt;\/container&gt;<\/p>\n<p>THEN CREATE A PHP FILE IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/Block\/Example.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\SimpleValidUiComponent\\Block;<\/p>\n<p>use Magento\\Framework\\View\\Element\\BlockInterface;<\/p>\n<p>class Example extends \\Magento\\Framework\\View\\Element\\AbstractBlock<br \/>\n{<br \/>\npublic function toHtml()<br \/>\n{<br \/>\nreturn &#8216;&lt;h1&gt;Hello PHP Block Rendered in JS&lt;\/h1&gt;&#8217;;<br \/>\n}<br \/>\n}<\/p>\n<p>OK. CLEAR THE CACHE AND RELOAD.<br \/>\nIT&#8217;D PRINT:<br \/>\nMagento Admin<\/p>\n<p>This is my template, there are many like it, but this one is mine.<br \/>\nHello PHP Block Rendered in JS<\/p>\n<p>Hijacking htmlContent<br \/>\nTHIS IS ANOTHER WAY TO RENDER TEMPLATE WITH A COMPONENT CLASS:<br \/>\nMODIFY \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/view\/adminhtml\/ui_component\/pulsestorm_simple_valid.xml:<br \/>\n&lt;container &#8230;&gt;<br \/>\n&#8230;<\/p>\n<p>&lt;htmlContent class=&#8221;Pulsestorm\\SimpleValidUiComponent\\Component\\Simple&#8221; name=&#8221;our_first_content&#8221;&gt;<br \/>\n&lt;argument name=&#8221;data&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;item name=&#8221;config&#8221; xsi:type=&#8221;array&#8221;&gt;<br \/>\n&lt;item name=&#8221;component&#8221; xsi:type=&#8221;string&#8221;&gt;Pulsestorm_SimpleValidUiComponent\/js\/pulsestorm_simple_component&lt;\/item&gt;<br \/>\n&lt;\/item&gt;<br \/>\n&lt;\/argument&gt;<br \/>\n&lt;\/htmlContent&gt;<br \/>\n&lt;\/container&gt;<\/p>\n<p>CREATE A COMPONENT FILE IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/Component\/Simple.php:<br \/>\n&lt;?php<br \/>\nnamespace Pulsestorm\\SimpleValidUiComponent\\Component;<br \/>\nclass Simple extends \\Magento\\Ui\\Component\\AbstractComponent<br \/>\n{<br \/>\nconst NAME = &#8216;html_content_pulsestorm_simple&#8217;;<br \/>\npublic function getComponentName()<br \/>\n{<br \/>\nreturn self::getName();<br \/>\n}<br \/>\n}<\/p>\n<p>CREATE THE KNOCKOUT JS VIEW MODEL IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/view\/adminhtml\/web\/js\/pulsestorm_simple_component.js:<br \/>\ndefine([&#8216;uiElement&#8217;,&#8217;ko&#8217;], function(Element, ko){<br \/>\nviewModelConstructor = Element.extend({<br \/>\ndefaults: {<br \/>\ntemplate: &#8216;Pulsestorm_SimpleValidUiComponent\/pulsestorm_simple_template&#8217;<br \/>\n}<br \/>\n});<\/p>\n<p>return viewModelConstructor;<br \/>\n});<\/p>\n<p>THEN CREATE THE TEMPLATE IN \/Library\/WebServer\/Documents\/Projects\/magentoce215\/app\/code\/Pulsestorm\/SimpleValidUiComponent\/view\/adminhtml\/web\/template\/pulsestorm_simple_template.html:<br \/>\n&lt;h1&gt;Our Remote Knockout Template!&lt;\/h1&gt;<\/p>\n<p>THEN clear your cache and reload the page<br \/>\nIT&#8217;D PRINT:<br \/>\nMagento Admin<\/p>\n<p>This is my template, there are many like it, but this one is mine.<br \/>\nOur Remote Knockout Template!<\/p>\n<p>CONCLUSION SO FAR:<\/p>\n<p>Magento uses Knockout.js to render front end interfaces.<\/p>\n<p>By default, Knockout.js uses the entire HTML page as a view, and a javascript object for the view model.<\/p>\n<p>To use Knockout.js, programmers create a javascript constructor function. Knockout.js uses this constructor function to instantiate a view model.<\/p>\n<p>Magento added a custom Knockout.js binding named scope. Scope allows different areas of the page to use different view models.<\/p>\n<p>These different view models are instantiated by the Magento_Ui\/js\/core\/app RequireJS module. This module is embedded in the page via an x-magento-init script, and this module uses a large data structure rendered via the backend\u2019s UI Component classes and XML. This data structure configures a number of RequireJS modules called \u201ccomponents\u201d.<\/p>\n<p>These components are \u201cview model constructor factories\u201d. The Magento_Ui\/js\/core\/app application uses these RequireJS components to create view model constructors, and then uses the instantiated view model constructor function to instantiate view models. Finally, the Magento_Ui\/js\/core\/app application registers each instantiated view model object, (by name), with the uiRegistry RequireJS module. The view model\u2019s registered names come from the large data structure rendered via the backend\u2019s UI Component classes and XML.<\/p>\n<p>The view model constructor objects are based on a Magento built javascript object system. This object system uses RequireJS modules as classes, and uses underscore.js for inheritance and method\/property sharing. There\u2019s also some Magento secret sauce in there. The base class is the uiClass module. The uiElement class\/module extends from the uiClass class\/module. Most of Magento\u2019s Knockout.js view model constructors are uiElement objects.<\/p>\n<p>Above, we mentioned the uiRegistry, uiClass, and uiElement RequireJS modules. These are RequireJS \u201cmap aliases\u201d that point to the real modules at Magento_Ui\/js\/lib\/registry\/registry, Magento_Ui\/js\/lib\/core\/class, and Magento_Ui\/js\/lib\/core\/element\/element respectively.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>REF: http:\/\/alanstorm.com\/category\/magento-2\/ SETTING VirtualHost REF:https:\/\/medium.com\/@JohnFoderaro\/how-to-set-up-apache-in-macos-sierra-10-12- bca5a5dfffba MODIFY \/private\/etc\/apache2\/extra\/httpd-vhosts.conf: &#8230; &lt;VirtualHost *:80&gt; ServerName magentoce215.lcoal ServerAlias www.magentoce215.local DocumentRoot &#8220;\/Library\/WebServer\/Documents\/Projects\/magentoce215&#8221; DirectoryIndex index.php &lt;Directory &#8220;\/Library\/WebServer\/Documents\/Projects\/magentoce215&#8221;&gt; AllowOverride All Allow from All Require all granted &lt;\/Directory&gt; ErrorLog &#8220;\/private\/var\/log\/apache2\/magentoce215_error.log&#8221; CustomLog &#8220;\/private\/var\/log\/apache2\/magentoce215_access.log&#8221; common &lt;\/VirtualHost&gt; MODIFY \/etc\/hosts: &#8230; 127.0.0.1 magentoce215.local &#8230; RESTART APACHE: sudo apachectl restart OPEN http:\/\/magentoce215.local\/ INSTALL PESTLE (https:\/\/github.com\/astorm\/pestle) Satrias-MacBook-Pro:~ teddy$ curl &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2018\/01\/09\/magento-2-alan-storm-tutorial\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Magento 2 Alan Storm Tutorial&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,71],"tags":[],"class_list":["post-2519","post","type-post","status-publish","format-standard","hentry","category-macosx","category-magento"],"_links":{"self":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/2519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=2519"}],"version-history":[{"count":1,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/2519\/revisions"}],"predecessor-version":[{"id":2520,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/2519\/revisions\/2520"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=2519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=2519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=2519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}