Import from xml script - paint layouts

Has anyone out there used the import_from_xml script to apply paint layouts? just need help on the format for the action statement. so far i have this (which doesn't import) where 7433 is the page asset id and 655 is the paint layout id

    
    set_paint_layout_7433
    set_paint_layout
    [[output://create_Page_Standard_7433.assetid
    655
    


ps: is there any internal documentation about the import from xml script? seems to me a lot of knowledge is probably inside the programmers brains (not good for disaster recovery!)

Hi Bruce,


All the info about this script is on the forums, not documented elsewhere.



If you search forums for import_from_xml you'll hopefully find everything you need.

unfortunately i didn't on paint layouts and while there maybe some discussions, nothing beats a well documented manual. in the absence of such a manual it might be handy for someone to map out what each element in the xml actually does. one of the drawbacks of relying on discussion forums is you get solutions but they might be for versions 2 years ago!

Hi Bruce,



There are many Trigger Action Types which would need to be documented. Coupled with the fact that importing is an advanced area of Matrix and one in which we usually recommend assistance, there is no documentation planned for this and similar scripts.



The best resource at the moment is these forums and the Trigger Action code found in the core/assets/system/triggers/trigger_action_types directory. This directory contains all of the available types and there are comments at the top of each file describing available options.



In this case for Paint Layouts, the <layout_assetid> tag should be used instead of <value> for the XML supplied. If you would like to override the Paint Layout for a particular asset instead of allowing it to cascade, the <override_layout_assetid> tag would be used.



Edit: Added "system" portion to path name

okay it worked (paint layout was applied to new page) but i did get some error messages id like to stop (eventually ill be importing 438 pages)


Undefined index: layout_map

Undefined index: override_layout_assetid



This was with the script:


    
    set_paint_layout_7433
    set_paint_layout
    [[output://create_Page_Standard_7433.assetid
    655
    


Should i be putting a null value in for the override anyway?

    

[quote]okay it worked (paint layout was applied to new page) but i did get some error messages id like to stop (eventually ill be importing 438 pages)


Undefined index: layout_map

Undefined index: override_layout_assetid



This was with the script:


    
    set_paint_layout_7433
    set_paint_layout
    [[output://create_Page_Standard_7433.assetid
    655
    


Should i be putting a null value in for the override anyway?

    
[/quote]
From the code it looks like these values are referenced even if they are not set, causing the PHP Notice error described.
As you have suggested, please specify the <layout_map> and <override_layout_assetid> as empty elements to get around these errors. This will not affect the successful execution of the action.

Edit: I have lodged this issue as Bug 3563, however the workaround mentioned above still applies.