From 48ec27d49d31a2a06bffd5142dc944195a398012 Mon Sep 17 00:00:00 2001 From: Roman Snitko Date: Fri, 5 Oct 2018 20:15:35 +0200 Subject: [PATCH 01/14] Enhancements for CLI section (argument and option added) --- .../7. Utilize the CLI.md | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/1. Magento Architecture and Customization Techniques/7. Utilize the CLI.md b/1. Magento Architecture and Customization Techniques/7. Utilize the CLI.md index 184e0ed..12a2433 100644 --- a/1. Magento Architecture and Customization Techniques/7. Utilize the CLI.md +++ b/1. Magento Architecture and Customization Techniques/7. Utilize the CLI.md @@ -48,21 +48,32 @@ This class must extends from [\Symfony\Component\Console\Command\Command](https: setName('example:hello') - ->setDescription('Hello world command') - ->setDefinition($options); + ->setDescription('Hello world command'); + + // Positional argument + $this->addArgument( + 'myargument', + InputArgument::REQUIRED, + 'Positional required argument example' + ); + + // Not required option + $this->addOption( + 'myoption', + null, + InputOption::VALUE_OPTIONAL, + 'Option example', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT + ); + parent::configure(); } From 4690e26fec2dfdd9b45ed48f9796ade2c70cf977 Mon Sep 17 00:00:00 2001 From: Sergey Date: Sun, 7 Oct 2018 20:42:44 +0300 Subject: [PATCH 02/14] Utilize modes and application initialization --- ...ze modes and application initialization.md | 52 +++++++++++++------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/2. Request Flow Processing/1. Utilize modes and application initialization.md b/2. Request Flow Processing/1. Utilize modes and application initialization.md index 6c3c00b..2a17a57 100644 --- a/2. Request Flow Processing/1. Utilize modes and application initialization.md +++ b/2. Request Flow Processing/1. Utilize modes and application initialization.md @@ -9,11 +9,11 @@ - configure autoloader - PSR-4 prepend generation\Magento -\Magento\Framework\App\Bootstrap::*createApplication* +[\Magento\Framework\App\Bootstrap](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Bootstrap.php)::*createApplication* - just call object manager->create -\Magento\Framework\App\Bootstrap::*run* +[\Magento\Framework\App\Bootstrap](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Bootstrap.php)::*run* - set error handler - assert maintenance @@ -27,7 +27,7 @@ ### Application class -bootstrap->createApplication() +[bootstrap->createApplication()](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Bootstrap.php#L230) - [\Magento\Framework\App\Http](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Http.php) - index.php, pub/index.php load config area by front name @@ -64,19 +64,26 @@ Notes: [\Magento\Framework\App\Http::launch](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Http.php#L128) 1. detect config area by front name -`\Magento\Framework\App\AreaList` - areas from argument di.xml +```php +_areaList->getCodeByFrontName($this->_request->getFrontName()); +$this->_state->setAreaCode($areaCode); +$this->_objectManager->configure($this->_configLoader->load($areaCode)); +``` + +`\Magento\Framework\App\AreaList` - areas from argument di.xml ([AreaList](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/AreaList.php)) - frontend = [frontname null, router "standard"] --- *default when nothing matched* - adminhtml - [frontNameResolver=..., router "admin"] - \Magento\Backend\App\Area\FrontNameResolver::getFrontName(checkhost) + [\Magento\Backend\App\Area\FrontNameResolver::getFrontName(checkhost)](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Backend/App/Area/FrontNameResolver.php#L83) system config `admin/url/use_custom`, `admin/url/custom` - crontab = null - webapi_rest = [frontName `/rest`] - webapi_soap = [frontname `/soap`] -1. ObjectManagerInterface::configure - selected area code -1. result = FrontControllerInterface->dispatch -1. ResultInterface.renderResult into response object +1. [ObjectManagerInterface->configure()](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/ObjectManager/ObjectManager.php#L82) - selected area code +1. result = FrontControllerInterface->dispatch() +1. [ResultInterface->renderResult()](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/AbstractResult.php#L122) into response object 1. event `controller_front_send_response_before` (request, response) @@ -95,7 +102,7 @@ Notes: - "webapi_rest (frontName `/rest`) - preference module-webapi/etc/webapi_rest/di.xml - *\Magento\Webapi\Controller\Rest* - "webapi_soap" (frontname `/soap`) - preference module-webapi/etc/webapi_rest/di.xml - *\Magento\Webapi\Controller\Soap* -### [App\FrontController](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/FrontController.php): +### [\Magento\Framework\App\FrontController](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/FrontController.php): - routerList - action = router[].match @@ -111,17 +118,32 @@ Notes: - [\Magento\Framework\Controller\ResultInterface](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/ResultInterface.php) - renderResult, setHttpResponseCode, setHeader - Raw, Json, Forward, Layout, Page, Redirect + Implementations: + - [Result\Raw](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/Result/Raw.php) -> Result\AbstractResult + - [Result\Json](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/Result/Json.php) -> Result\AbstractResult + - [Result\Forward](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/Result/Forward.php) -> Result\AbstractResult + - [\Magento\Framework\View\Result\Layout](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/View/Result/Layout.php) -> Result\AbstractResult + - [\Magento\Framework\View\Result\Page](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/View/Result/Page.php) -> \Magento\Framework\View\Result\Layout + - [Controller\Result\Redirect](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/Result/Redirect.php) -> Result\AbstractResult + +- [\Magento\Framework\App\ResponseInterface](https://github.com/magento/magento2/blob/2.2-develop/lib/internal//Magento/Framework/App/ResponseInterface.php) - sendResponse -- \Magento\Framework\App\ResponseInterface - sendResponse - Console\Response, Response\FileInterface, PhpEnvironment\Response, Webapi\Response, Rest\Response + Implementations: + - [Console\Response](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Console/Response.php) + - [\Magento\MediaStorage\Model\File\Storage\FileInterface](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/MediaStorage/Model/File/Storage/Response.php) -> \Magento\Framework\App\Response\Http + - [\Magento\Framework\HTTP\PhpEnvironment\Response](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Response.php) -> \Zend\Http\PhpEnvironment\Response + - [\Magento\Framework\Webapi\Response](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Webapi/Response.php) -> \Magento\Framework\HTTP\PhpEnvironment\Response + - [\Magento\Framework\Webapi\Rest\Response](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Webapi/Rest/Response.php) -> \Magento\Framework\Webapi\Response -### [Controller\Rest](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Webapi/Controller/Rest.php): -- process path [/$store]/... - specific store, [/all]/... - admin store, /... - default store +### [\Magento\Webapi\Controller\Rest](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Webapi/Controller/Rest.php) -> \Magento\Framework\App\FrontControllerInterface: + +- preference for FrontController set in [etc/webapi_rest/di.xml](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Webapi/etc/webapi_rest/di.xml#L32) +- process path [/$store]/... - specific store, [/all]/... - admin store (0), /... - default store - a. process schema request /schema - b. or process api request (resolve route, invoike route -> service class with params) -### [Controller\Soap](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Webapi/Controller/Soap.php): +### [\Magento\Webapi\Controller\Soap](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Webapi/Controller/Soap.php) -> \Magento\Framework\App\FrontControllerInterface: + - process path (same as REST) - a. generate WSDL ?wsdl - b. or generate WSDL service list ?wsdl_list From e0e8e6612f2a6ca396ccd2961229ea64e75edd6b Mon Sep 17 00:00:00 2001 From: Sergey Date: Sun, 7 Oct 2018 20:43:23 +0300 Subject: [PATCH 03/14] Utilize modes and application initialization --- .../1. Utilize modes and application initialization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2. Request Flow Processing/1. Utilize modes and application initialization.md b/2. Request Flow Processing/1. Utilize modes and application initialization.md index 2a17a57..670f2af 100644 --- a/2. Request Flow Processing/1. Utilize modes and application initialization.md +++ b/2. Request Flow Processing/1. Utilize modes and application initialization.md @@ -124,7 +124,7 @@ $this->_objectManager->configure($this->_configLoader->load($areaCode)); - [Result\Forward](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/Result/Forward.php) -> Result\AbstractResult - [\Magento\Framework\View\Result\Layout](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/View/Result/Layout.php) -> Result\AbstractResult - [\Magento\Framework\View\Result\Page](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/View/Result/Page.php) -> \Magento\Framework\View\Result\Layout - - [Controller\Result\Redirect](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/Result/Redirect.php) -> Result\AbstractResult + - [Result\Redirect](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/Result/Redirect.php) -> Result\AbstractResult - [\Magento\Framework\App\ResponseInterface](https://github.com/magento/magento2/blob/2.2-develop/lib/internal//Magento/Framework/App/ResponseInterface.php) - sendResponse From 434715c583179b469f892cd54d4d30145725118d Mon Sep 17 00:00:00 2001 From: Sergey P Date: Mon, 15 Oct 2018 18:52:24 +0300 Subject: [PATCH 04/14] Update 3. Utilize configuration XML and variables scope.md --- ...3. Utilize configuration XML and variables scope.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/1. Magento Architecture and Customization Techniques/3. Utilize configuration XML and variables scope.md b/1. Magento Architecture and Customization Techniques/3. Utilize configuration XML and variables scope.md index 5bfd9d2..f6b6e71 100644 --- a/1. Magento Architecture and Customization Techniques/3. Utilize configuration XML and variables scope.md +++ b/1. Magento Architecture and Customization Techniques/3. Utilize configuration XML and variables scope.md @@ -6,15 +6,15 @@ - `address_formats.xml` - `address_types.xml` - format code and title only - `cache.xml` - name, instance - e.g. full_page=Page Cache -- `catalog_attributes.xml` - catalog_category, catalog_product, unassignable, used_in_autogeneration, quote_item +- `catalog_attributes.xml` - catalog_category, catalog_product, unassignable, used_in_autogeneration, quote_item [*](https://www.atwix.com/magento-2/how-to-access-custom-catalog-attributes/) - `communication.xml` - `config.xml` - defaults -- `crontab.xml` - group[], job instance, method, schedule -- `cron_groups.xml` -- `di.xml` - preference, plugins, virtual type +- `crontab.xml` - group[], job instance, method, schedule [*](https://github.com/magento-notes/magento2-exam-notes/blob/master/1.%20Magento%20Architecture%20and%20Customization%20Techniques/6.%20Configure%20event%20observers%20and%20scheduled%20jobs.md#crontabxml) +- `cron_groups.xml` [*](https://github.com/magento-notes/magento2-exam-notes/blob/master/1.%20Magento%20Architecture%20and%20Customization%20Techniques/6.%20Configure%20event%20observers%20and%20scheduled%20jobs.md#cron-groups) +- `di.xml` - preference, plugins, virtual type [*](https://devdocs.magento.com/guides/v2.2/extension-dev-guide/build/di-xml-file.html) - `eav_attributes.xml` - locked entity attributes (global, unique etc.) - `email_templates.xml` - id label file type module -- view/frontend/email/name.html -- `events.xml` - observers, shared, disabled +- `events.xml` - observers, shared, disabled [*](https://github.com/magento-notes/magento2-exam-notes/blob/master/1.%20Magento%20Architecture%20and%20Customization%20Techniques/6.%20Configure%20event%20observers%20and%20scheduled%20jobs.md#demonstrate-how-to-configure-observers) - `export.xml` - `extension_attributes.xml` - for, attribute code, attribute type - `fieldset.xml` From d557344f47c5e6e6c312047cfdd3f1e3bff4c8c6 Mon Sep 17 00:00:00 2001 From: Roman Snitko Date: Thu, 18 Oct 2018 17:39:32 +0300 Subject: [PATCH 05/14] Corrected parent class name for cron config + minor formatting --- .../Magento Architecture and Customization Techniques.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1. Magento Architecture and Customization Techniques/Magento Architecture and Customization Techniques.md b/1. Magento Architecture and Customization Techniques/Magento Architecture and Customization Techniques.md index afe00cb..5a14299 100644 --- a/1. Magento Architecture and Customization Techniques/Magento Architecture and Customization Techniques.md +++ b/1. Magento Architecture and Customization Techniques/Magento Architecture and Customization Techniques.md @@ -329,7 +329,7 @@ generate check for standalone process ``` -\Magento\Cron\Model\Config\Data extends \Magento\Cron\Model\Config\Data +`\Magento\Cron\Model\Config\Data` extends `\Magento\Framework\Config\Data` - merges \Magento\Cron\Model\Config\Reader\Db::get from Database Sample DB structure: From 34b438d6bd8d32e92e9726091caa0c28e59e3df1 Mon Sep 17 00:00:00 2001 From: Sergey P Date: Fri, 19 Oct 2018 08:25:56 +0300 Subject: [PATCH 06/14] Update 2. Demonstrate ability to process URLs in Magento.md --- .../2. Demonstrate ability to process URLs in Magento.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2. Request Flow Processing/2. Demonstrate ability to process URLs in Magento.md b/2. Request Flow Processing/2. Demonstrate ability to process URLs in Magento.md index deeae68..1f8a01b 100644 --- a/2. Request Flow Processing/2. Demonstrate ability to process URLs in Magento.md +++ b/2. Request Flow Processing/2. Demonstrate ability to process URLs in Magento.md @@ -87,7 +87,7 @@ Module UrlRewrite: Product: -- event `catalog_product_save_before` +- event `catalog_product_save_after` * [ProductProcessUrlRewriteSavingObserver](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/CatalogUrlRewrite/Observer/ProductProcessUrlRewriteSavingObserver.php) * \Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator::generate * deleteByData, replace From e9dc91f778fccec3f593eb843981153fab4059f8 Mon Sep 17 00:00:00 2001 From: Sergey P Date: Fri, 19 Oct 2018 08:32:27 +0300 Subject: [PATCH 07/14] Update 2. Demonstrate ability to process URLs in Magento.md --- .../2. Demonstrate ability to process URLs in Magento.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/2. Request Flow Processing/2. Demonstrate ability to process URLs in Magento.md b/2. Request Flow Processing/2. Demonstrate ability to process URLs in Magento.md index 1f8a01b..5bbdbb7 100644 --- a/2. Request Flow Processing/2. Demonstrate ability to process URLs in Magento.md +++ b/2. Request Flow Processing/2. Demonstrate ability to process URLs in Magento.md @@ -86,10 +86,12 @@ Module UrlRewrite: - \Magento\UrlRewrite\Model\UrlPersistInterface::replace Product: - -- event `catalog_product_save_after` +- event `catalog_product_save_before` - generate URL key by product name (if url key wasn't provided) + * [ProductUrlKeyAutogeneratorObserver](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/CatalogUrlRewrite/Observer/ProductUrlKeyAutogeneratorObserver.php) + * [\Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator::getUrlKey](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php#L125) +- event `catalog_product_save_after` - generate and replace URL rewrites (if changed url_key, categories, websites or visibility) * [ProductProcessUrlRewriteSavingObserver](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/CatalogUrlRewrite/Observer/ProductProcessUrlRewriteSavingObserver.php) - * \Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator::generate + * [\Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator::generate](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGenerator.php#L128) * deleteByData, replace Category: From 31b65612b0f1390007c627a46821127468af1f27 Mon Sep 17 00:00:00 2001 From: Sergey P Date: Fri, 19 Oct 2018 08:39:43 +0300 Subject: [PATCH 08/14] Update 2. Demonstrate ability to process URLs in Magento.md --- .../2. Demonstrate ability to process URLs in Magento.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/2. Request Flow Processing/2. Demonstrate ability to process URLs in Magento.md b/2. Request Flow Processing/2. Demonstrate ability to process URLs in Magento.md index 5bbdbb7..a2d54b2 100644 --- a/2. Request Flow Processing/2. Demonstrate ability to process URLs in Magento.md +++ b/2. Request Flow Processing/2. Demonstrate ability to process URLs in Magento.md @@ -86,10 +86,12 @@ Module UrlRewrite: - \Magento\UrlRewrite\Model\UrlPersistInterface::replace Product: + - event `catalog_product_save_before` - generate URL key by product name (if url key wasn't provided) * [ProductUrlKeyAutogeneratorObserver](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/CatalogUrlRewrite/Observer/ProductUrlKeyAutogeneratorObserver.php) * [\Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator::getUrlKey](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php#L125) -- event `catalog_product_save_after` - generate and replace URL rewrites (if changed url_key, categories, websites or visibility) + +- event `catalog_product_save_after` - generate and replace URL rewrites (when changed url_key, categories, websites or visibility) * [ProductProcessUrlRewriteSavingObserver](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/CatalogUrlRewrite/Observer/ProductProcessUrlRewriteSavingObserver.php) * [\Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator::generate](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGenerator.php#L128) * deleteByData, replace @@ -104,6 +106,8 @@ Category: * child category.url_path - event `catalog_category_save_after` - when changed (key, anchor, products) + * [CategoryProcessUrlRewriteSavingObserver](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/CatalogUrlRewrite/Observer/CategoryProcessUrlRewriteSavingObserver.php#L90) + * [\Magento\CatalogUrlRewrite\Observer\UrlRewriteHandler::generateProductUrlRewrites](https://github.com/magento/magento2/blob/2.2-develop/app/code//Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php#L124) * ... lots of logic From e52ca32b9bfa366c3dc76165571c2b471fdd044e Mon Sep 17 00:00:00 2001 From: Sergey P Date: Fri, 19 Oct 2018 09:12:38 +0300 Subject: [PATCH 09/14] Update 3. Demonstrate ability to customize request routing.md --- ...Demonstrate ability to customize request routing.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/2. Request Flow Processing/3. Demonstrate ability to customize request routing.md b/2. Request Flow Processing/3. Demonstrate ability to customize request routing.md index 588be43..8a54a4d 100644 --- a/2. Request Flow Processing/3. Demonstrate ability to customize request routing.md +++ b/2. Request Flow Processing/3. Demonstrate ability to customize request routing.md @@ -41,13 +41,17 @@ reference route by ID and add own module "before" original module. ### How do you handle custom 404 pages? -1. If front controller catches NotFoundException, it changes action name *"noroute"* and continues loop. +1. If [front controller](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/FrontController.php#L61-L65) catches [\Magento\Framework\Exception\NotFoundException](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Exception/NotFoundException.php), it changes action name *"noroute"* and continues loop. E.g. catalog/product/view/id/1 throws NotFoundException. catalog/product/noroute is checked. 1. If standard router recognizes front name but can't find controller, it tries to find *"noroute"* action from last checked module. E.g. catalog/brand/info controller doesn't exist, so catalog/brand/noroute will be checked. + + [\Magento\Framework\App\Router\Base::getNotFoundAction](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Router/Base.php#L237) 1. If all routers didn't match, default controller provides two opportunities: - - set default 404 route in admin config `web/default/no_route` - - register custom handler in noRouteHandlerList + - set default 404 route in admin config `web/default/no_route` (see: [\Magento\Framework\App\Router\NoRouteHandler::process](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Router/NoRouteHandler.php#L34)) + - register custom handler in [noRouteHandlerList](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Router/NoRouteHandlerList.php) + * backend (sortOrder: 10) [Magento\Backend\App\Router\NoRouteHandler](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Backend/App/Router/NoRouteHandler.php#L44) -> `adminhtml/noroute/index` + * default (sortOrder: 100) [Magento\Framework\App\Router\NoRouteHandler]((https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Router/NoRouteHandler.php) From 2c025f71a1cd8a71681e5a8ff72194c1e85e4cf4 Mon Sep 17 00:00:00 2001 From: Sergey P Date: Fri, 19 Oct 2018 09:13:12 +0300 Subject: [PATCH 10/14] Update 3. Demonstrate ability to customize request routing.md --- .../3. Demonstrate ability to customize request routing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2. Request Flow Processing/3. Demonstrate ability to customize request routing.md b/2. Request Flow Processing/3. Demonstrate ability to customize request routing.md index 8a54a4d..d6d4706 100644 --- a/2. Request Flow Processing/3. Demonstrate ability to customize request routing.md +++ b/2. Request Flow Processing/3. Demonstrate ability to customize request routing.md @@ -52,6 +52,6 @@ reference route by ID and add own module "before" original module. 1. If all routers didn't match, default controller provides two opportunities: - set default 404 route in admin config `web/default/no_route` (see: [\Magento\Framework\App\Router\NoRouteHandler::process](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Router/NoRouteHandler.php#L34)) - - register custom handler in [noRouteHandlerList](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Router/NoRouteHandlerList.php) + - register custom handler in [noRouteHandlerList](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Router/NoRouteHandlerList.php): * backend (sortOrder: 10) [Magento\Backend\App\Router\NoRouteHandler](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Backend/App/Router/NoRouteHandler.php#L44) -> `adminhtml/noroute/index` - * default (sortOrder: 100) [Magento\Framework\App\Router\NoRouteHandler]((https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Router/NoRouteHandler.php) + * default (sortOrder: 100) [Magento\Framework\App\Router\NoRouteHandler](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Router/NoRouteHandler.php) From 77bb5b4e3b0ea700d29d3153775dc7b68b1ce8b9 Mon Sep 17 00:00:00 2001 From: Roman Snitko Date: Sat, 20 Oct 2018 23:10:38 +0300 Subject: [PATCH 11/14] Fixed typos in "Request Flow Processing" chapter --- .../1. Utilize modes and application initialization.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2. Request Flow Processing/1. Utilize modes and application initialization.md b/2. Request Flow Processing/1. Utilize modes and application initialization.md index 6c3c00b..de10be7 100644 --- a/2. Request Flow Processing/1. Utilize modes and application initialization.md +++ b/2. Request Flow Processing/1. Utilize modes and application initialization.md @@ -93,7 +93,7 @@ Notes: - *Default* global preference app/etc/di.xml - Magento\Framework\App\FrontController - "frontend", "adminhtml", "crontab" area code - no preference, use default *App\FrontController* - "webapi_rest (frontName `/rest`) - preference module-webapi/etc/webapi_rest/di.xml - *\Magento\Webapi\Controller\Rest* -- "webapi_soap" (frontname `/soap`) - preference module-webapi/etc/webapi_rest/di.xml - *\Magento\Webapi\Controller\Soap* +- "webapi_soap" (frontname `/soap`) - preference module-webapi/etc/webapi_soap/di.xml - *\Magento\Webapi\Controller\Soap* ### [App\FrontController](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/FrontController.php): @@ -119,7 +119,7 @@ Notes: ### [Controller\Rest](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Webapi/Controller/Rest.php): - process path [/$store]/... - specific store, [/all]/... - admin store, /... - default store - a. process schema request /schema -- b. or process api request (resolve route, invoike route -> service class with params) +- b. or process api request (resolve route, invoke route -> service class with params) ### [Controller\Soap](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Webapi/Controller/Soap.php): - process path (same as REST) From e8c296cc16511fb79fa14b267286e507bb4ede2c Mon Sep 17 00:00:00 2001 From: Roman Snitko Date: Wed, 31 Oct 2018 08:39:08 +0200 Subject: [PATCH 12/14] Added link to the official routing-related docs --- .../3. Demonstrate ability to customize request routing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2. Request Flow Processing/3. Demonstrate ability to customize request routing.md b/2. Request Flow Processing/3. Demonstrate ability to customize request routing.md index 588be43..7a83c09 100644 --- a/2. Request Flow Processing/3. Demonstrate ability to customize request routing.md +++ b/2. Request Flow Processing/3. Demonstrate ability to customize request routing.md @@ -2,7 +2,7 @@ ## Describe request routing and flow in Magento. -Frontend routers: +[Frontend routers](https://devdocs.magento.com/guides/v2.2/extension-dev-guide/routing.html): - robots (10) - urlrewrite (20) From 1074f4816b6c9fb198de323fc630fc80806311ae Mon Sep 17 00:00:00 2001 From: Roman Snitko Date: Thu, 1 Nov 2018 07:40:02 +0200 Subject: [PATCH 13/14] Minor typos corrected --- .../4. Determine the layout initialization process.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/2. Request Flow Processing/4. Determine the layout initialization process.md b/2. Request Flow Processing/4. Determine the layout initialization process.md index b9a7626..6223c03 100644 --- a/2. Request Flow Processing/4. Determine the layout initialization process.md +++ b/2. Request Flow Processing/4. Determine the layout initialization process.md @@ -10,7 +10,7 @@ View\Layout::*build* = View\Layout\Builder::*build* - once 1. generateLayoutXml - joins `_updates` into XML string, loads XML object, initiailzes `_elements` = [] - * layout.generaXml + * layout.generateXml * no events 1. generateLayoutBlocks - layout.generateElements @@ -213,11 +213,11 @@ Only containers ### page result.renderResult: -- View\Resuls\PageFactory.create +- View\Result\PageFactory.create - View\Result\Page::addDefaultHandle - `default`, `$fullActionName` - View\Page\Config.publicBuild = build -- View\Page\Builder.build - extends View\Layout\Builder, custom readPageLayout on step generatelayoutBlocks +- View\Page\Builder.build - extends View\Layout\Builder, custom readPageLayout on step generateLayoutBlocks * (inherit) loadLayoutUpdates * (inherit) generateLayoutXml From 50a5af8e2b4378c0184e4245ade3c73c38197d8a Mon Sep 17 00:00:00 2001 From: Roman Snitko Date: Mon, 5 Nov 2018 12:08:49 +0200 Subject: [PATCH 14/14] Additional fixes to UI section --- ...ity to utilize themes and the template structure.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/3. Customizing the Magento UI/1. Demonstrate ability to utilize themes and the template structure.md b/3. Customizing the Magento UI/1. Demonstrate ability to utilize themes and the template structure.md index 992f512..3e1e5e8 100644 --- a/3. Customizing the Magento UI/1. Demonstrate ability to utilize themes and the template structure.md +++ b/3. Customizing the Magento UI/1. Demonstrate ability to utilize themes and the template structure.md @@ -244,7 +244,7 @@ All same as layout, but subDir 'page_layout': *_*/page_layout/override/theme/*/*/*.xml ``` -View\Layout\ProcessorInterface = View\Model\Layout\Merg +View\Layout\ProcessorInterface = View\Model\Layout\Merge - $updates - array of all found string XML file contents E.g. ``` updates[] = ' Design > Implementation > [Edit] > Design Rule > User Agent Rules +- theme can apply dynamically based on browser user agent as exception - enter regexp in + _Content > Design > Implementation > [Edit] > Design Rule > User Agent Rules_ Full page cache and design exception: ``` plugin magento-store/etc/di.xml: @@ -285,9 +285,9 @@ View\Layout\ProcessorInterface = View\Model\Layout\Merg theme.xml - parent -Determine theme hierarch of existing project: +Determine theme hierarchy of existing project: -- Go to Content > Design > Configuration +- Go to _Content > Design > Configuration_ - Check "Theme Name" column on row with store view under question - find paths to all available themes in app/etc/design/frontend/* or vendor/*/theme-* (conventionally) or find programmatically: