You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#115775 Plugin to add patern/remplacement in folder

Posted in ‘Suggestions & Feature Requests’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Ryan on Tuesday, 16 January 2024 14:43 GMT

roland_d_alsace
Hi Ryan.

I think it would be interesting to be able to add patern/remplacement possibilities with a plugin.

In my case it would be necessary for me to be able to convert for example $season with the calculated value of the sports season.

Is it possible by using onWfFileSystemGetPathVariables event in a plugin ?

Regards.
Roland

Ryan
In my case it would be necessary for me to be able to convert for example $season with the calculated value of the sports season. Is it possible by using onWfFileSystemGetPathVariables event in a plugin ?
Yes, a custom system plugin would be able to access this event and the $variables array to add the variable and associated value for processing by the filesystem, eg:

public function onWfFileSystemGetPathVariables(&$variables)
    {
        // no variable set
        if (empty($variables)) {
            return;
        }

        // prepare as regular expression
        $variable = '/' . preg_quote('$season', '/') . '/';
        
        // get season using internal function
        $value = $this->getCurrentSeason();

        $variables['path_pattern'][] = $variable;
        $variables['path_replacement'][] = $value;
}

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.