Frage | Antworten |
Where Theme Stored? | Themes are stored in app/design/[area] |
How Many Required Files on theme? | theme.xml and registration.php are the only two required files. |
How to Overriding existing Magento or 3rd-party module template file? | Overriding existing Magento or 3rd-party module template file is as simple as replicating the directory structure in your theme |
Creating theme not recommended? | You can extend and customize an available theme or even create one from scratch, although that is not recommended. |
How to create custom theme? | Creating a theme usually involves copying and modifying any necessary templates, creating XML fles to adjust layouts, and creating the necessary styles to make the frontend (or adminhtml area) match the design specifcations |
Custom themes are located ? | in the app/design/frontend directory. They continue the notation of ThemePackage_ThemeName. |
when etc/view.xml is required ? | if there is no parent theme |
What required files for theme? | only required files are registration.php & theme.xml |
theme.xml Worked? | theme.xml specifes the parent (fallback) theme, the theme name, and a preview image |
what task done by registration.php? | The registration fle is identical to a module’s (in app/code/MyCompany/MyModule) registration.php |
How do you defne theme hierarchy for your project? | Specify the parent theme in the parent node of theme.xml |
How to use using the debugger, or by enabling template hints CLI? | bin/magento dev:template-hints:enable |
How to debugger template manually? | Another way is to fnd a unique string in the HTML (translation, tag or class). Searching the entire project directory |
How can you modify a template from Magento_Catalog module? | you are modifying a template from the Magento_Catalog module, create a Magento_Catalog folder inside your theme directory |
How to manage file when extending an existing theme? | If you are extending an existing theme, check that theme to see if the file exists there. If so, copy it from there. |
Where copy in your theme vendor/magento/module-customer/ view/frontend/templates/account/dashboard/info.phtml? | app/design/frontend/SwiftOtter_Flow/Magento_ Customer/templates/account/dashboar/info.phtml |
How can Blocks can be referenced ? | Blocks can be referenced with the $block variable into a template. |
What methods can be accessed $block variable (Blocks can be referenced with the $block variable into template)? | As such, only public methods can be accessed |
What is Blocks? | Blocks are PHP classes that provide information to the .phtml templates |
What are the lifeblood of normally static .phtml files? | block |
block allows ? | block allows for a separation of duties from the template file: blocks handle data access and retrieval (dependency injection works here ), whereas the templates display information |
By default, template blocks are injected? | By default, template blocks are injected with a \Magento\Framework\View\ Element\Template\Context object |
Context object $this->validator contains a number of other objects that are loaded into the instance? | $this->validator: \Magento\Framework\View\Element\Template\ File\Validator |
Context object $this->resolver contains a number of other objects that are loaded into the instance? | $this->resolver: \Magento\Framework\View\Element\Template\ File\Resolver |
Context object $this->_flesystem contains a number of other objects that are loaded into the instance? | $this->_flesystem: \Magento\Framework\Filesystem |
Context object $this->templateEnginePool contains a number of other objects that are loaded into the instance? | $this->templateEnginePool: \Magento\Framework\View\ TemplateEnginePool |
Context object $this->_storeManager contains a number of other objects that are loaded into the instance? | $this->_storeManager: \Magento\Store\Model\ StoreManagerInterface |
Context object $this->_appState contains a number of other objects that are loaded into the instance? | $this->_appState: \Magento\Framework\App\State |
Context object $this->pageConfg contains a number of other objects that are loaded into the instance? | $this->pageConfg: \Magento\Framework\View\Page\Confg |
Where abstract block is found? | in vendor/magento/framework/View/Element/ AbstractBlock.php |
Identify the stages in the lifecycle of a block? | 1.Block is created (__construct). 2.The setLayout method is called, assigning _layout to be the current layout object. |
When Magento is ready to obtain the HTML? | 1. toHtml is called • The view_block_abstract_to_html_before event is triggered. • If a cache entry is present, the template will not be loaded. • _beforeToHtml • _toHtml • _afterToHtml (regardless of whether or not the cached value was used) • The view_block_abstract_to_html_after event is triggered 2. HTML is returned |
plugins can only modify the flow of data from--- methods? | public |
best choice for globally modifying data ? | Blocks do not expose many public methods and so the best choice for globally modifying data is often a plugin for toHtml |
the use cases for events triggered from blocks is------? | limited |
who is responsible for rendering the block as HTML? | the toHtml is responsible for rendering the block as HTML |
When using a template ---- involves loading a template? | toHtml |
What do If a cache entry exists _toHtml ? | If a cache entry exists, that is returned. Otherwise, the toHtml method passes off rendering to the _toHtml method for the actual rendering. |
when a block can be cached? | 1. cache lifetime is not null. 2. block_html cache type is enabled. |
How long cache lifetime default? | By default, the cache lifetime is not set, so this needs to be specifed to enable caching the block |
cache key is generated? | If caching can happen, a cache key is generated ($this->getCacheKey()). |
searched process? | The rendered HTML is then searched for the presence of SID parameters (session IDs), which are then replaced with a placeholder before the string is saved |
Where renders HTML to the user.? | Template (vendor/magento/framework/View/Element/Template.php): renders HTML to the user. |
Where prints a text string? | Text (vendor/magento/framework/View/Element/Text.php): |
Where prints a ListText? | ListText (vendor/magento/framework/View/Element/Text/ ListText.php): similar to a container as it returns the output of each of the child blocks. |
What task done by Templates? | Templates are used to display HTML |
Where extend the basic template-type block? | There are many blocks that . find a number of them in the vendor/magento/ framework/View/Element directory |
Why Layout XML ? | Layout XML is the powerful link between blocks and templates. |
What task done by <block/> in layout XML in the <body/> tag? | <block/>: creates a new block. Expects the full namespace and class name for the block (do not put a “\” at the beginning of the type). |
What task done by <container/> in layout XML in the <body/> tag? | <container/>: a grouping of blocks. Specify an HTML tag and class to wrap the output of the child blocks |
What task done by <arguments> in layout XML in the <body/> tag? | <arguments> and <argument>: sets a value in the block’s $data array |
What task done by <referenceBlock/> in layout XML in the <body/> tag? | <referenceBlock/>: targets an existing block to make modifcations to it. |
What task done by <referenceContainer/> in layout XML in the <body/> tag? | <referenceContainer/>: targets an existing container to make modifcations to it |
What task done by <move/> & <remove/> in layout XML in the <body/> tag? | <move/>: enables moving of an existing block to another block or container. • <remove/>: removes a block. |
What task done by <update/> in layout XML in the <body/> tag? | <update/>: adds a layout handle to be displayed |
Where to create a new layout XML fle | Ensure the following directory exists: app/code/AcmeWidgets/ ProductPromotor/view/frontend/layout |
new layout XML fle extention? | Create a file for the handle to modify and append .xml to it. Example: “catalog_product_view.xml” |
Where Add the <page/>new layout XML fle? | Add the <page/> XML node at the root |
Describe how to pass variables from layout to block? | Use the arguments and argument nodes. These call setData on the block. As such, you can retrieve these values later by calling the getData() method. This is also how the ViewModel is specifed. |
<script type="text/x-magento-init"> used ? | <script type="text/x-magento-init"> used with a JSON object to load modules and initialize them with servergenerated confguration |
data-mage-init attribute instantiates? | data-mage-init attribute instantiates a Javascript module with any provided confguration for the current tag |
How use JavaScript and UI Components? | Using JavaScript and UI Components to load customer-specifc data allows Magento to keep a page fully-cached. |
How Magento 2 utilizes RequireJS? | Magento 2 utilizes RequireJS to create a modular and extensible system in JavaScript |
How Javascript modules can be completely custom, can extend a UI Component module? | Javascript modules can be completely custom, can extend a UI Component module, or be a jQuery widget. They can be asynchronously loaded or embedded directly in a page using a plain <script/> tag. Magento’s <script type="text/xmagento-init"/> allows for loading modules and passing even complex confguration info into them |
<script/> tag. Magento’s <script type="text/xmagento-init"/> allows for loading modules and passing even complex confguration info into them? | modules handle much interaction between the website user and the Magento PHP application |
Where UI components work well? | UI components work well in the admin panel for grids and forms. Customizing these pages involves making updates to XML instead of repeating many lines of boilerplate PHP |
requirejs-confg.js? | manages the dependency injection preferences for the Magento JavaScript application. RequireJS confg can be used to load your module instead of an existing resource. It can also create aliases for module paths |
Write example of requirejs-confg.js?? | var confg = { "map": {"*":{"mage/adminhtml/wysiwyg/tiny_mce/setup":"AcmeWidgets_ProductPromoter/js/WysiwygSetupOverride" } } }; |
x-magento-init? | Initializes a JavaScript module with specifc parameters |
Write example x-magento-init?? | <sc type="text/x-magento-init"> { ".hero": { // creates a new JavaScript object instance for each selected item "AcmeWidgets_ProductPromoter/js/hero": { imageCount: 1}}} </sc> |
data-mage-init? | This is similar to x-magento-init except that it is an attribute for an HTML tag |
Write example data-mage-init? | <div class="hero" data-mage-init='{ "AcmeWidgets_ ProductPromoter/js/hero": { imageCount: 1} }'> </div> |
Möchten Sie mit GoConqr kostenlos Ihre eigenen Karteikarten erstellen? Mehr erfahren.