Setting parent location of assets created with Edit+ asset creation wizard


(Birdg) #1

Hi,

 

We are adding to the items available in the asset creation wizard so that users can choose to create custom "asset types" that we have created (which are data records with metadata schemas applied).

 

[attachment=669:acw.jpg]

 

However, this will not work unless the user puts the new asset in the right folder (so that the metadata schema cascades onto the new asset).

 

Is there a better way of doing this so that the new asset always has the metadata schema applied and the user cannot make mistakes? Or is there a different way of creating custom asset types?

 

Many thanks,

 

Graham  acw.jpg (21.8 KB)


(Nic Hubbard) #2

Absolutely you can create your own custom Asset Types. You would need to know PHP though, and understand how Matrix does assets. I have created a number of different asset types.

 

Are you needing a guide on how to do this? 

 

Here is a really old guide: http://matrix.squiz.net/developer/tutorials/creating-an-asset

 

If you have any questions, or need help building one, let me know.


(Bart Banda) #3

You should be able to configure a plugin for the asset wizard so that when certain asset types are selected, they choose the parent folder automatically. You might also be able to do something with a trigger. 

In the past I created a plugin that allowed you to create a new type of special template page, which was a standard page asset, but it was placed in a specific folder automatically and the user only had access to enter the name of the page they wanted to create.

 

It would require some digging and playing around with the EES JS code, but I'm sure it would be possible. 


(Birdg) #4

Hi both,

Many thanks. I will try the JavaScript route first. :slight_smile:


Graham


(Scott Hall) #5

Hey Graham

 

You could just go out of the box to avoid any massive overheads in dev and support. And potential problems when updating/upgrading later. One suggestion might me:

 

1. Just use the data record asset already provided in the creation wizard, under "Other". It's just a couple extra clicks.

 

2. Add the root node for where these assets get created to the default asset finder panel. That way, when selecting a create location, its always there in their face every time the finder opens. Have a look at the "assetFinderLocations" as per http://manuals.matrix.squizsuite.net/ees/chapters/installation#Constructing-the-Configuration-File

 

3. For even fast adding, educate them to navigate to the root node (after implementing #1) which will mean they can just choose "Select Current Asset" as the create location, without having to open and traverse the finder.

 

Just a suggestion.

 

Cheers

 

Scotty


(Birdg) #6

Hi Scotty,

Sounds like a plan. Thanks for the reply. :slight_smile:


Graham


(Birdg) #7

Hi,

 

We have set things up as Scott suggested but we've hit a snag. If we have more than one data_record type_code in our createWizardCategories object, it just picks the first one.

 

We had hoped to have a variety of entries in the wizard called "Quote", "Twitter feed", "Course", "Profile" etc (all actually Data Records) but when the user selects the one they want, it always displays the name of the first one in the createWizardCategories list. It's as if there is a string match of some kind going on and it's just matching on the first "data_record" item it finds.

 

Is this a known problem? Is there a workaround?

 

Thanks,

 

Graham


(Scott Hall) #8

Hey Graham

 

This is where it gets super tricky, and why it's usually a good idea to steer clear of customising this space. Sounds like the format of that property isn't correct, and we don't have it well documented so understandable.

 

The other thing (mentioned in the comments) is that, as soon as you use that property, it blows away existing categories.

    // [OPTIONAL] Create wizard customisations
    // If this configuration is present it will determine the categories and asset types
    // and their order in the create wizard.
    createWizardCategories: {
        'My Custom Stuff': {
        assets: [
            {
                type_code:      'folder',
                display_name:   'My Custom Folder',
                interface_type: 'wizard_default',
                description:    'My custom folder description.'
            },
            {
                type_code:      'data_record',
                display_name:   'Custom Data Record',
                interface_type: 'wizard_default',
                description:    'My custom data record description.'
            },
            {
                type_code:      'data_record',
                display_name:   'Custom Data Record',
                interface_type: 'wizard_default',
                description:    'My custom data record description.'
            }
        ]
        } // End 
    }, // Specifying anything here will completely replace any defaults

The best way to understand what can be used in that property is to look at how the existing categories are already coded by downloading package to desktop (http://manuals.matrix.squizsuite.net/download-ees) and opening ees > Libs > wizards > EasyEditAssetWizardManager.js and "var AssetWizardCategoryData" at the top.