Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

<action> tag Documention
 
Beirut
Jr. Member
 
Total Posts:  1
Joined:  2010-07-14
 

I’m having trouble finding documentation regarding the various options related to the <action> tag. All I need are solid documentation links and I’ll be good to go.

For Example, I’m having trouble with this declaration:
  <action method="addLink" translate="label title” module="contacts" ifconfig="contacts/contacts/enabled">
   method=” “ (I can see that its calling a method, but where do I find the documentation for all the “possible” methods?)
   module=” “ (I don’t understand how module relates to the method addLink)
   ifconfig=” “ (I don’t understand how ifconfig relates to the method addLink)

If possible, could someone point me in the right direction, in terms of documentation.
Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mohal
Jr. Member
 
Total Posts:  20
Joined:  2012-04-08
 
Beirut - 26 August 2010 12:02 PM

I’m having trouble finding documentation regarding the various options related to the <action> tag. All I need are solid documentation links and I’ll be good to go.

For Example, I’m having trouble with this declaration:
  <action method="addLink" translate="label title” module="contacts" ifconfig="contacts/contacts/enabled">
   method=” “ (I can see that its calling a method, but where do I find the documentation for all the “possible” methods?)
   module=” “ (I don’t understand how module relates to the method addLink)
   ifconfig=” “ (I don’t understand how ifconfig relates to the method addLink)

If possible, could someone point me in the right direction, in terms of documentation.
Thanks

Any luck?

 
Magento Community Magento Community
Magento Community
Magento Community
 
brandonrunyon
Jr. Member
 
Total Posts:  1
Joined:  2012-10-31
 

Seriously here now… how can you have a template engine with such a high dependency on XML (or any formatted api) and then just not let users know what they do? Am I supposed to reverse engineer your maniacal theme engine? Is the community really your only source of support and documentation? Is there a set of PHP files I can dig through to see what magento expects to find and take action upon so I too can simply apply a theme? Is there a timeline for this or is documenting what Magento does too much scope creep for an enterprise grade ecommerce system? Even providers of proprietary systems let developers know how to do basic theming… tisk tisk on you!

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

Hello.
First of all @brandonrunyon: sorry I don’t think I can explain everything about Magento themes here. Because there is a limit for the number of characters in a post and because I still don’t know everything about it.

I can try to explain how the action tag works.

First of all an <action> tag is placed inside a block.
Something like this

<block type="some/type_here" name="someblock">
<
action method="setSomething" translate="something" module="module" ifconfig="some/path/here"><something>Text here</something></action>
</
block>

this means that the method ‘setSomething’ is called from the block with the alias ‘some/type_here’. The class that corresponds to ‘some/type_here’ usually is Mage_Some_Block_Type_Here. (but it can be different values depending on the extensions you have).
The ‘method’ attribute of the action tag is always required and can be any method from the class I just described (the block itself) including magic methods (setter & getter).

All the tags inside the <action> tag are parameters to the method you call. In the example the contents of the tag ‘<something>’ is passed as a parameter to the method ‘setSomething’.

‘translate’ means that before passing the parameter to the method the parameter is translated using the module defined in the ‘module’ attribute.

Something like this:

Mage::helper('module')->__('Something');

If the module is missing the current module will be used.
Something like this:

$this->__('Something');

the ifconfig settings tells Magneto to call the method only if a certain config settings is set to ‘Yes’ (or is not false or null or zero).
So basically the xml above translates to

if (Mage::getStoreConfigFlag('some/path/here')){
    $block 
Mage::app()->getLayout()->getBlock('someblock');
    
//or
    //$block = Mage::app()->getLayout()->createBlock('some/block_type');
    
$block->setSomething(Mage::helper('module')->__('Something'));
}

The actions can also be placed inside <reference> tags.
It’s basically the same thing but this means that the block was created previously. The method is called on the block instance with the name the same as the ‘name’ attribute of the reference tag.

<reference name="someblock">
<
action method="setSomething" translate="something" module="module" ifconfig="some/path/here"><something>Text here</something></action>
</
reference>

This is almost the same thing as the code above but the block has to be declared somewhere else in the layout.

<block type="some/type_here" name="someblock" />

I hope I made some things clear here.

Cheers,
Marius.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top