I'm trying to implement a filesystem plugin that I'd like to use in a specific JCE profile for com_content component and Editors users.
Like the variables $id, $username, $usertype, etc. that you can use to specify dinamically the root directory, I'd like to add a variable, i.e. $articleid, that will dinamically set the root directory to a folder named with the id of the article you're currently editing (i.e. /mypath/123).
So, every article has its own folder (this is very useful in a scenario when article editing need to be moved frequently from a usergroup to another, and you don't want to migrate files).
Well, in my scenario Editors can't create articles, they can just edit an existing one. So I'm sure that JCE is called for an article that already has an id.
But I can realize this? I'm trying to override the WFFileSystem getRootDir() method but I can't figure out how to detect consistently the current article id.
I've tried this way, and it works, but I'm not sure it is reliable...
if(!empty($registry->get('com_content')->edit->article->id)) {
$article_id = reset($registry->get('com_content')->edit->article->id);
if (!empty($article_id)) {
if ($article_id>0) {
$root .= '/' . $article_id;
...
Any suggestions?