Download the PHP package tkotosz/block-decorator-magento2 without Composer

On this page you can find all versions of the php package tkotosz/block-decorator-magento2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package block-decorator-magento2

BlockDecorator module for Magento 2

License Latest Stable Version Scrutinizer Code Quality Build Status

This module allows it to decorate Blocks used in the layout with extra data based on interfaces implemented by the blocks.

Installation

Install by adding to your composer.json:

How it works?

The module registers an "after plugin" for the Magento\Framework\View\Element\BlockFactory which used by Magento to instantiate Blocks. In this plugin the block object created by the factory passed over to all registered decorators to decorate the block with extra data if needed. Each decorator is responsible for checking the type of the block and decide whether it needs to do anything.

How to use?

  1. Create an interface which can be implemented by any block to get a specific data. (example: Tkotosz\BlockDecorator\View\Element\Block\CurrentProduct\ProductNameAwareInterface)

  2. Create your block class in the same way as you do it normally and implement your interface created in the 1st step. (example: Tkotosz\BlockDecorator\Block\Product\View\ProductName)

  3. Create your own decorator which can decorate the blocks with the required data when applicable (when your interface is implemented by the block). To create a the decorator you just need to create a new class which implements the Tkotosz\BlockDecorator\View\Element\Block\Decorator\DecoratorInterface. (example: Tkotosz\BlockDecorator\View\Element\Block\Decorator\CurrentProductName)

  4. Register your decorator in the Magento di like this:

(example: see how Tkotosz\BlockDecorator\View\Element\Block\Decorator\CurrentProductName is registered in the src/etc/di.xml)

  1. Add your new block to any layout, when the block is instantiated your decorator will run to set the required data, which later can be used when the block is rendered.

All versions of block-decorator-magento2 with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
magento/framework Version ^100.1|^101.0|^102.0
magento/module-catalog Version ^101.0|^102.0|^103.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tkotosz/block-decorator-magento2 contains the following files

Loading the files please wait ....