Ok, maybe I am missing something, or I never needed this before, but is there a keyword that prints the asset type code, such as page_standard? I don't want the friendly name that %asset_type% prints.
Does this exist? Can't find it in the manuals.
Indeed the %asset_type% keyword just print the friendly name and I could not find a keyword in the code that prints the actual type code.
[quote]
Indeed the %asset_type% keyword just print the friendly name and I could not find a keyword in the code that prints the actual type code.
[/quote]
Hmm. How does Matrix create those "friendly" names? Are they hard coded? Or is there a function that writes them?
[quote]
Hmm. How does Matrix create those “friendly” names? Are they hard coded? Or is there a function that writes them?
[/quote]
Asset_Manager::getTypeInfo() get those friendly names. e.g.
$GLOBALS[‘SQ_SYSTEM’]->am->getTypeInfo($asset->type(), ‘name’);
What you are after is “$asset->type()” whose keyword, like what Mohamed said above, isn’t available.
Ash
[quote]
Asset_Manager::getTypeInfo() get those friendly names. e.g.
$GLOBALS[‘SQ_SYSTEM’]->am->getTypeInfo($asset->type(), ‘name’);
What you are after is “$asset->type()” whose keyword, like what Mohamed said above, isn’t available.
Ash
[/quote]
Yeah I was just trying to see if there was a way to rewrite the friendly string into the type code.
[quote]
Yeah I was just trying to see if there was a way to rewrite the friendly string into the type code.
[/quote]
It gets them from the asset.xml file located at the root level of each asset folder. Once you run the install steps it loads these into the sq_ast_typ table. If you change these, it will change all across your backend interface (not a good idea).
[quote]
It gets them from the asset.xml file located at the root level of each asset folder. Once you run the install steps it loads these into the sq_ast_typ table. If you change these, it will change all across your backend interface (not a good idea).
[/quote]
No no, I only meant trying to rewrite them in a non destructive way, using JavaScript. 
Thanks.
[quote]
No no, I only meant trying to rewrite them in a non destructive way, using JavaScript. 
Thanks.
[/quote]
Hi Nic,
I am not sure how important this is for you but if you really need this, then the data returned by JS_API::getGeneral() has a property 'type_code' which, I think, is what you need here.
Ash
[quote]
I am not sure how important this is for you but if you really need this, then the data returned by JS_API::getGeneral() has a property 'type_code' which, I think, is what you need here.
[/quote]
Thanks Ash, I figured out a way to do it. 