Configuring a Trigger to Prevent Page Assets From Being Created


(Benjamin Cardenas) #1

I followed the instructions in the Tutorials section on Configuring a Trigger to Prevent Image Assets From Being Created and adapted it for Page assets.

It works fine on the backend but does not prevent the asset creation in Edit+ plus. Has anyone else tried to do this?

Or do you know if it is by design that Edit+ does not accept the Fail action set by the trigger?

Thanks,

Ben


(Bart Banda) #2

Edit+ creates and edits assets using the JS API, so some trigger implementations you do for admin might have to get done slightly different for Edit+, depending on the event and condition and action off course.

Instead of using a trigger to disable page creation in Edit+, you might be better off by just customising the Edit+ config file to not allow it?

For example:
createWizardAssetBlackList: ['page_standard'],


(Benjamin Cardenas) #3

Hi Bart,
Thanks for the information about how Edit+ creates and edits assets. I suspected that it did in a way that it did not activate the trigger.

In this case, the usefulness of the trigger was that I want for the restriction to occur only when the asset is created in specific sections of the site. So blacklisting the option does not work.

I am exploring using conditional keyword replacements to hide the element through Edit+'s CSS.

Something like:
%begin_globals_user_metadata_user.role^eq:ICE%
#ees_assetCreationWizardAssetTypes
.page_standard {
display: none;
}
%end_globals%

I still need to tweak the logic so that it matches user group/permissions and location. And even then, it may not work because they need to still be able to create pages while in a different location. So there is nothing stopping them from start the process elsewhere and then select the location where I donā€™t want them to create a page.

It looks more and more like one of those things that do not directly transfer from our old CMS to Squiz. So we may need to change business processes to adapt to a hands-down better platform.

The ideal solution would be something that does the check like the trigger does. But I donā€™t know enough to figure out whether we can or how to influence Edit+'s actions.

Anyway, thanks for clarifying that triggers wonā€™t ā€˜seeā€™ this particular action in Edit+. Iā€™ll keep exploring.

Ben


#4

Depends on what exactly you want to do, but this works on both backend & EasyEdit+:

Events:

  • Before asset created
  • Simple edit accessed

Tree location

  • where you want to restrict creation

Asset is of Type

  • which ever you want

Actions
Error (the message you add is shown when user hovers mouse cursor over the error icon)

or move them elsewhere, add email notification to admins/ editors etc.


(Benjamin Cardenas) #5

Iā€™ve tried exactly what you mention but Edit+ is letting it by. I know that the trigger is working because I added for it to send an email before throwing the error and I receive the email but the asset is created.

I will revisit and make sure that I am meeting all the conditions just in case I am missing something.


(Bart Banda) #6

Thatā€™s weird, I tried it in the latest version of 5.3 and I got it to work with very similar trigger setup.
The only difference I had that is noticeable was that I had ā€œIgnore Permissionsā€ enabled on the trigger action.
Can you try that?

Also, what version of Matrix are you in?


#7

Hi Bart, sorry I havenā€™t been checking the forums for a while. Yes, you need to enable the ā€œIgnore permissionsā€ and also enable ā€œNon criticalā€ in case you can let it fail.

We are on 5.1.3


(Harinder Singh) #8

[6.48.0]
Hi guys, the Fail action is not available anymore in triggers. Is there any other option available?


(David Schoen) #9

I believe the fail referenced earlier was renamed to ā€œErrorā€ at some point.

Itā€™s on the ā€œTrigger Log Messageā€ action type.


(Harinder Singh) #10

It seems like this is the option Iā€™m looking for.

Since moving to DXP, weā€™ve been experiencing spam submissions. Hopefully, this option will help us control the submissions better.

Thanks, mate.