In a paragraph I have an image field. For the path of this field I use the offered contextual token:

contents/images/[current:form:node:title]

But in the file system the path

[current/form/node/title]

will be created.

I'd like to have the node title as a folder after creating a node.

Am I right, that I can use this token, when it's been offered in the token list?

If yes, what am I doing wrong?

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

deelite created an issue. See original summary.

mxh’s picture

Version: 1.0.3 » 1.0.x-dev
Assigned: deelite » Unassigned
Category: Support request » Bug report

Am I right, that I can use this token, when it's been offered in the token list?

Your expectation is not wrong. I'm considering this as a bug. The problem at this place is, that the place where the file destination is being generated is currently outside the scope of the form context stack. The form context stack is currently only covering the rendering process of a form, whereas this file destination is already being generated way before. I'm trying to find an approach for it.

mxh’s picture

Assigned: Unassigned » mxh

mxh’s picture

Assigned: mxh » Unassigned
Status: Active » Needs review

Please have a look whether MR1 works for you.

mxh’s picture

There are some followers in here, so please review the merge request and give feedback whether it works for you or not.

deelite’s picture

Sorry, I didn't get messages about news here. Is this patch part of the last dev version?

mxh’s picture

You can checkout the issue fork of the merge request with the commands as shown in the IS above.

mxh’s picture

Do you need any help with reviewing this?

deelite’s picture

Sorry for the delay. I checked out the fork. Now [current:form:node:title] isn't available anymore. Setting it as a token results in an error, that the token isn't available.

mxh’s picture

What is the error message? Do you get a detailed stack trace in the logs? I can only help you out when having more details about the error you've received. Please post the exact output of the error message and provide more details if available (e.g. logged errors).

deelite’s picture

Drupal message when saving the field settings:

1 Fehler wurde gefunden: Dateiverzeichnis

In recent log I have nothing about that. As I wrote:

[current:form:node:title]

isn't available in tokens. Also all other form tokens.

mxh’s picture

If you have the Inline Form Errors module installed, a concrete error message should show up on the field. I need that concrete error message. Alternatively, try to see whether you have more details in the message when that Inline Form Errors module is not installed.

mxh’s picture

Further tips that may help bringing this forward:

  • Use english as interface language, because that's easier for maintainers to find the according error in code.
  • Provide more details, e.g. What value are you using for the directory input field (is it only the token?). Have you tried with current:form:node:nid or parent:form:node:nid ? Also please note that when the node is new, it may be that you don't get any information at all, because the node doesn't exist yet in the database.

By providing more details, it helps me to trim down the scope of the possible causes of this problem.

mxh’s picture

Any news about this?

  • mxh committed 14643b1f on 1.0.x
    Issue #3293780: Tokenized image path not resolved
    
mxh’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.