How hard would it be to create a custom file type asset, such as an MP3 or audio asset, and a video asset?
Custom File Type creation
That depends on what you want the asset to do. If you just want to distinguish between file types, then its pretty easy.
I want to do this because I need a way to have custom Format Types for Audio and Video when doing a search. Could I do this another way?
[quote]I want to do this because I need a way to have custom Format Types for Audio and Video when doing a search. Could I do this another way?
[right][post=“15495”]<{POST_SNAPBACK}>[/post][/right][/quote]
No, the only way to have custom format types is with custom asset types.
Ok, I will try to look at the files for the pdf asset and create my own for video and audio.
I built the video asset quickly, and added it to my system. It worked to add the video file, but when I make some changes on the details screen, it gives me the following error:
MySource Warning File: [SYSTEM_ROOT]/core/include/asset_edit_interface.inc Line: 1887 Message: Function not found for processing field "Details/ [SYS0187]
I am also getting this on the details screen:
Function "paintFilename" not found for painting
Any thoughts on what I did wrong?
In your implementation you’re missing a screen edit function and it’s hard to guess why.
Copy the Word Doc asset type and play with that. You can remove the getContent() function because you will not be indexing anything.
Matrix Developer tutorials are here: http://matrix.squiz.net/developer/tutorials
Do I need to keep and edit the contents of the CVS folder?
Also, I went back through the word document asset, and made my changes for a video asset. Re-added it to the system, and I am still getting the same errors. Anyone willing to look at my code?
BTW, I have gone through the asset creation tutorial, but it was not much help in this case.
No, you don't.
[quote]Also, I went back through the word document asset, and made my changes for a video asset. Re-added it to the system, and I am still getting the same errors. Anyone willing to look at my code?
[right][post="15515"]<{POST_SNAPBACK}>[/post][/right][/quote]
Email it to me ( avi dot miller at squiz dot net ) and I'll take a look. I can't guarantee a timeframe though, because I'm pretty busy this week.
Take another look at the word_doc asset: There are NO functions in the actual code (besides getContent()). You should just replicate those files: Your custom asset should have no actual functions in it, as that'll all get handled by the parent File asset.
But would I be changing the names of the files, then in turn be changing a few places in the code where those are referenced? I tried to just change the needed things in asset.xml and word_doc.inc, but I get errors when doing step_03. I suspect that I should be changing the names of the files, and where it is referenced in the code.
Sorry, yes: The files all need to be named properly to match asset.xml and the constructors need to be unique as well (matching the filename). But there's no actual code in any of them. They're really just blank constructors.
You should go through the asset creation tutorial again. If something is not clear or just doesn't make sense please post either here or elsewhere so we can improve the tutorial.
You're trying to create the most primitive type of asset. If you're a developer and the tutorial makes no sense, we need to improve it. If you're not a developer… we might still need to improve, but the tutorial will never cover the basics of php.
Yes, I am TRYING to be a developer. I apologize for my ignorance in certain areas, but I am trying to do my best here. I will continue to work on this simple asset, and see if I can get it working.
It seems that I am now getting a problem with Matrix not updating my updated asset. I have been making changes in the command line to the asset, and then running step_03 and compile locals, but it seems that no changes are being made when I go back into matrix.
Is there some soft of cache for this? I know something is wrong, because I removed my custom asset icon, and ran step_03 and it still shows in Matrix.
[quote]Is there some soft of cache for this? I know something is wrong, because I removed my custom asset icon, and ran step_03 and it still shows in Matrix.
[right][post=“15545”]<{POST_SNAPBACK}>[/post][/right][/quote]
There is no cache for this: Matrix only requires step_03.php to install/remove assets. compile_locales.php is used to update the screen XML and language files, so if you change any of the XML files that define the screens, you need to re-run that as well.
If removing your asset and running step_03.php doesn’t remove it from Matrix, then the version you’re running the command-line script on and the version you’re viewing in your browser are probably not the same version.
[quote]Yes, I am TRYING to be a developer. I apologize for my ignorance in certain areas, but I am trying to do my best here. I will continue to work on this simple asset, and see if I can get it working.
[right][post=“15544”]<{POST_SNAPBACK}>[/post][/right][/quote]
I know how you feel: When I first started at Squiz, I was not that experienced in PHP. Matrix is probably one of the most complex PHP applications I’ve ever seen, so it can be quite daunting for a first-timer. There will be an moment in the future though where everything makes sense.
This URL should be recommended again. There is a tutorial there for building your own asset type which introduces you to the concept of assets, screens and installation. I highly recommend going through that tutorial before trying to build your own assets. All our developers start with it.