List all instantiable asset types as asset attribute select


(Nic Hubbard) #1

[attachment=419:Picture 1.png]


I am wanting to add a new attribute field that is exactly what an asset listing has for setting the Asset Types to list. I am wanting to use this in a custom asset to restrict to those assets.



Looking over the asset listing management file, I am not seeing where this code might be. Is this a custom array, that holds the type codes, since the user can add as many type codes as they want? How would this be handled in a processing function? Does Matrix have a function that does this already?



Thanks.
Picture 1.png (8.15 KB)


(Ashish Karelia) #2

Hi,
there is a call to "asset_type_chooser()" around line 77 in file listing_engine_edit_fns.inc in paintAssetTypes(). This will paint the needful for you and to process it there is a processAssetTypes(). Guess this is what you are after. For further interest asset_type_chooser() is defined in core/lib/html_form/html_form.inc . :slight_smile:



Regards,

Ash


(Nic Hubbard) #3

[quote]
Hi,

there is a call to "asset_type_chooser()" around line 77 in file listing_engine_edit_fns.inc in paintAssetTypes(). This will paint the needful for you and to process it there is a processAssetTypes(). Guess this is what you are after. For further interest asset_type_chooser() is defined in core/lib/html_form/html_form.inc . :slight_smile:



Regards,

Ash

[/quote]



Thanks I had been looking in the wrong files. I was looking at the asset listing page files, rather than listing engine files. :slight_smile:


(Nic Hubbard) #4

If I use the inherit option, is there a function that returns all the inherited asset types for a type code?


Update: I found it: $GLOBALS['SQ_SYSTEM']->am->getTypeDescendants('file'));