I can see that Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content::getImagesJson()
and app\design\adminhtml\default\default\template\catalog\product\helper\gallery.phtml
are responsible for putting the image data into the browser via the Product.Gallery
prototype class.
However, I can't track down where the image collection gets set on the Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content
block. I'm assuming its via a magic setter somewhere in the controller or layout, but I can't track it down.
Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content::getImagesJson()
has
$value = $this->getElement()->getValue();
if(count($value['images'])>0) {
foreach ($value['images'] as &$image) {
so something is populating the element
attribute of that block.
Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content
seems to be instantiated by Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery::getContentHtml()
but that doesn't set any attributes on the block.
I can see that Mage_Catalog_Model_Product_Attribute_Backend_Media::afterLoad()
populates the attribute with an array that matches the structure that the Product.Gallery
Javascript is looking for, but I'm still a little mystified as to where the Attribute gets tied to the rendering Block.
I think I need a diagram to keep this tangled web straight in my head!
Thanks,
Jonathan