Skip to content

Instantly share code, notes, and snippets.

@AndreFSilveira
Created October 29, 2015 15:29
Show Gist options
  • Save AndreFSilveira/87512f648ebbea154fda to your computer and use it in GitHub Desktop.
Save AndreFSilveira/87512f648ebbea154fda to your computer and use it in GitHub Desktop.
Detalhando as configurações do System.xml - Magento
label - it is label of the section displayed on the left side under the tab and on the right side as the page heading
sort_order – identifies the section position inside of the tab between the other sections
class – CSS class for section label in the tabs block (In PayPal module used for displaying of image instead of text)
header_css – CSS class used on section edit form (the page after clicking on the section label)
use_in_default - indicates that this section will be showed when “Default Values” is selected in “Current Configuration Scope”
use_in_website – indicates that this section will be showed when a website is selected in “Current Configuration Scope”
use_in_store – indicates that this section will be showed when a store view is selected in “Current Configuration Scope”
frontend_model – block class that is used as the section form render, by default used adminhtml/system_config_form
groups – contains definitions of groups those are described below
label – it is label of the configuration field
sort_order – identifies the field position inside of the configuration group if custom sort mechanism is not set
config_path – identifies to what configuration node the field value should be saved. If this field is not specified, configration field path will be used ([section_name]/[group_name]/[field_name]). In this example field value will be saved into mycustom_section/mycustom_group/mycustom_field node.
frontend_model – block class that is used as the field render, by default used adminhtml/system_config_form_field
frontend_type- the field input type for displaying of the form item. Possible values are:
text – Text input field
textarea – Textarea field
select – Dropdown field. Options for this field are retrieved from source_model
multiselect – Multiselect field. Options for this field are retrieved from source_model
import – File input field for importing of the data
export – File export button that is used for exporting of the data
allowspecific – Dropdown field that displays “Allow Specific Countries” and “All Countries” as its options
image – File input field for uploading of an image
and all the fields presented as Varien_Data_Form_Element_* …
If value is not specified, text input type will be used
can_be_empty – indicates that multiselect field can contain no values selected, otherwise empty selection will not be saved
source_model – specifies source model that returns option list for select and multiselect fields types. Value contains model class name or model callback. If you specify only class name your module should implement toOptionArray($isMultiselect) method, that will return a list of prepared option array for form element. If you specify model callback, your source model should just return only associative array of value-label pairs. Example of model callback: module_name/model_name::methodName
List of mostly used source models:
adminhtml/system_config_source_admin_page – returns list of all the items in Magento Admin menu
adminhtml/system_config_source_cms_page – returns list of CMS Pages
adminhtml/system_config_source_customer_group – returns list of customer groups
adminhtml/system_config_source_date_short – returns list of available short date formats
adminhtml/system_config_source_email_identity – returns list of email sending identities (General Contact, Sales Representative, etc)
adminhtml/system_config_source_email_template – returns list of transactional email templates
adminhtml/system_config_source_locale_country – returns list of localized country names
adminhtml/system_config_source_locale_currency – returns list of localized currency names
adminhtml/system_config_source_locale_timezone – returns list of localized timezone names
adminhtml/system_config_source_locale_weekdays – returns list of localized weekday names
adminhtml/system_config_source_order_status – returns list of available order statuses except pending payment
adminhtml/system_config_source_payment_allmethods – returns list of all payment methods
adminhtml/system_config_source_shipping_allmethods – returns list of all shipping methods
adminhtml/system_config_source_country – returns list of all countries from directory module
adminhtml/system_config_source_allregion – returns list of all country regions grouped by country
adminhtml/system_config_source_enabledisable – return list of two options (“Enable” and “Disable”)
adminhtml/system_config_source_notoptreq – return list of three options for customer widget mandatory indetificator (“Not”, “Optional”, “Required”).
adminhtml/system_config_source_yesno – return boolean options (“Yes”, “No”)
You can find more available source models at Mage_Adminhtml_Model_System_Config_Source_*
backend_model – specifies custom model for saving of configration value data. If you want to implement such custom logic, you should extend your backend model from Mage_Core_Model_Config_Data
use_in_default - indicates that this field will be showed when “Default Values” is selected in “Current Configuration Scope”
use_in_website – indicates that this field will be showed when a website is selected in “Current Configuration Scope”
use_in_store – indicates that this field will be showed when a store view is selected in “Current Configuration Scope”
tooltip – tooltip text for field. This text is displayed when the mouse is over the field. If you want to specify custom html block for text in tooltip, you should use tooltip_block
tooltip_block – block class name that will be used as tooltip for this field instead of tooltip text
validate- CSS class name that will be applied to form field. Used for validation of the field input. Some usual values:
required-entry – validates field value as non empty
validate-number – validates field value as numeric
validate-email – validates field value as valid email address
All the possible validation rules can be found at js/prototype/validation.js
comment- text that will be displayed before all the items in form, may contain some notice about field value format group or whatever you want. Also this field can use a comment generator model. In these case you need specify the following children for it:
model – model class name that should implement getCommentTextmethod with public access. Parameters those are passed to this method are the following:
$element – configuration node itself
$currentValue – current field value
//http://www.ecomdev.org/2010/10/27/custom-configuration-fields-in-magento.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment