Utilities - UltimateModuleCreator/umc-crud GitHub Wiki

This module comes with a set of classes that can be used in your module.

Admin buttons

Umc\Crud\Block\Adminhtml\Button\* - these buttons can be used in every admin form you have just by configuring them properly via etc/adminhtml/di.xml.

Admin controllers

Umc\Crud\Controller\Adminhtml\* - base controllers that can be extended and configured to do the basic operations (list / save / delete / inline edit / mass delete / upload images and files) for your entity

Generators.

Umc\Crud\Generator\* - will generated repositories and other classes that look and behave the same.

Models

  • Umc\Crud\Model\FileInfo - general model for retrieving information about the uploaded files
  • Umc\Crud\Model\Uploader - model in charge of uploading files

Resource Models

  • Umc\Crud\Model\ResourceModel\AbstractModel - your own entity resource model should extend this one if your entity is not connected many-to-many with the store views
  • Umc\Crud\Model\ResourceModel\StoreAwareAbstractModel - your own resource model should extend this one if your entity is connected many-to-many with store views (just like cms pages and blocks are)
  • Umc\Crud\Model\ResourceModel\Store - takes care of retrieving the associated store views to your collection items
  • Umc\Crud\Model\ResourceModel\Collection\AbstractCollection - your entity collection model should extend this one if your entity is not connected many-to-many with the store views
  • Umc\Crud\Model\ResourceModel\Collection\StoreAwareAbstractCollection - your entity collection model should extend this one if your entity connected many-to-many with the store views
  • Umc\Crud\Model\ResourceModel\Relation\Store\ReadHandler - fetches the related store views if your entity is connected many-to-many with the store views
  • Umc\Crud\Model\ResourceModel\Relation\Store\SaveHandler - saves the related store views if your entity is connected many-to-many with the store views

Source models

  • Umc\Crud\Source\Catalog\ProductAttribute - can be used as a source model for your entity fields that are of type select / multiselect and the options in the select should be product attributes. By default provides all attributes, but can be configured via di.xml to provided a filtered list of attributes
  • Umc\Crud\Source\Catalog\ProductAttributeOptions - can be used as a source model for your entity fields that are of type select / multiselect and the options in the select should be the options of a certain product attribute. (color for example).
  • Umc\Crud\Source\Catalog\ProductAttributeSet - can be used as a source model for your entity fields that are of type select / multiselect and the options in the select should be attribute sets
  • Umc\Crud\Source\Options - can be used as a source model for your entity fields that are of type select / multiselect and the options are custom values. You should create a virtual type from this and assign options to it. This eliminates the need to have a real class with select options which is basically a glorified array wrapped in a class.

Ui grid components

  • Umc\Crud\Ui\Component\Listing\ActionsColumn - can be used to add the actions column in your grid (...you know... the one with edit and delete links)
  • Umc\Crud\Ui\Component\Listing\Image - can be used to display an image attribute in your admin grid.

Ui form components

When retrieving the data for your entity from the db, it does not always match with the way the form expects the data to be. For example, multiselect fields are stored in a comma-separated way in the db, but the form component expects it to be an array of values. These form components transform data for different db fields to the format the form components expect it.

  • Umc\Crud\Ui\Form\DataModifierInterface - I'm sure that this module does not cover all the ways the data needs to be modified to fit the format the form expects it. So you can add your own modifiers. You just have to implement this interface
  • Umc\Crud\Ui\Form\DataModifier\NullModifier - It does nothing. It does not affect the data from the db. This should be used when your db data matches exactly the format the form component expects it.
  • Umc\Crud\Ui\Form\DataModifier\Multiselect - Transforms comma separated values to arrays. useful for multiselect fields
  • Umc\Crud\Ui\Form\DataModifier\Upload - Transforms the image / file names saved in your db to the format the upload components expect
  • Umc\Crud\Ui\Form\DataModifier\DynamicRow - Transforms the json encoded data from your db to arrays. Useful for dynamic rows components Umc\Crud\Ui\Form\DataModifier\CompositeDataModifier - Allows you to attach multiple modifiers at once to your form data without the need to modify the code itself. Just configuration.