0

From the creation form (any bundle), I need to get the content type label/name to use it in a link (in a block, for example) and pre-filter the View opened by this link.

Example :

The user wants to add a new Article and opens the Article creation form.

In a special block (let's say in Highlighted region), a link is displayed : "Clone existing".

This link leads to a View listing the existing Articles with a clone button for each.

This View can be filtered by content type.

So the link would be something like :

<a href"/existing-nodes?type=[node:content-type]">Clone existing</a>

How to get the [node:content-type] (just here to clarify, good old token) from the form?

Any tip would be nice.

0

Writing your own question is always useful.

I may have a solution, even if you may have something different, so please share.

I have built a Views block with a custom text (my link) as unique field (only show one result, you do not need to repeat the link, of course).

I have added a contextual filter based on content type with a default value provided by url, raw value, third component (node/add/mybundle_name), with case transform in lower case.

My link looks like :

<a href="/existing-nodes?type={{ raw_arguments.type }}">Clone existing</a>

And it works.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.