Widget definition for BE form fields in Magento
The general widget definition for BE form fields in Magento is:
1 2 3 4 5 6 7 8 9 10 11 |
<?xml version="1.0"?> <widgets> <widget_identifier type="blochtype/like_in_normal_blocks" translate="name description" module="modulname"> <name>Widgetname</name> <description>A useful description</description> <is_email_compatible>1</is_email_compatible> <parameters> <!-- field definition goes here --> </parameters> </widget_identifier> </widgets> |
The following snippets show how to define different form fields for the widget form: Template selector:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<template translate="label"> <label>Template</label> <visible>1</visible> <type>select</type> <value>cms/widget/link/link_block.phtml</value> <values> <default translate="label"> <value>cms/widget/link/link_block.phtml</value> <label>CMS Page Link Block Template</label> </default> <link_inline translate="label"> <value>cms/widget/link/link_inline.phtml</value> <label>CMS Page Link Inline Template</label> </link_inline> </values> </template> |
Fixed template:
1 2 3 4 5 6 7 |
<template translate="label"> <label>Template</label> <required>1</required>> <visible>0</visible> <type>text</type> <value>asksheldon_teaser/link.phtml</value> </template> |
Text input:
1 2 3 4 5 6 7 8 |
<column_count translate="label description"> <visible>1</visible> <required>1</required> <label>Columncount</label> <description>Number of Colums</description> <type>text</type> <sort_order>1</sort_order> </column_count> |
Enable / disable select:
1 2 3 4 5 6 7 8 9 |
<enabled translate="label"> <label>Enable</label> <frontend_type>select</frontend_type> <source_model>adminhtml/system_config_source_yesno</source_model> <sort_order>10</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </enabled> |
Multiselect (customer groups):
1 2 3 4 5 6 7 8 9 10 |
<customer_groups translate="label comment"> <label>Customer groups</label> <frontend_type>multiselect</frontend_type> <source_model>adminhtml/system_config_source_customer_group</source_model> <sort_order>11</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> <comment>Groups for Friends & Family discounts.</comment> </customer_groups> |
Category Selector:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<catid translate="label"> <visible>1</visible> <required>1</required> <label>Category</label> <type>label</type> <helper_block> <type>adminhtml/catalog_category_widget_chooser</type> <data> <button translate="open"> <open>Select Category...</open> </button> </data> </helper_block> </catid> |
To determine the category ID and load the […]