Drupal StackExchange

How do I limit the allowed taxonomy terms basing on the content type?

1 month 3 weeks ago

I have two different content types, Computer and Chemistry, and taxonomy terms for all articles (content types) which store the methodology of the article. The taxonomy hierarchy is the following.

  • Articles
    • Computer
      • Arithmetic (Term ID: 1)
      • DMA (Term ID: 2) // abbreviation for "Direct Memory Access"
    • Chemistry
      • NGE (Term ID: 3) // abbreviation for "Noble Gas Elements"
      • DMA (Term ID: 4) // abbreviation for "Dynamic Mechanical Analysis"

When users are creating or editing a node of type Chemistry, just NGE and DMA (whose ID is 4) should be allowed to select.

I only need one taxonomy vocabulary, since there are too many content types, and if I want to add a vocabulary for each of them, then it leads too many vocabularies; more importantly it removes the ability of freely navigating in different types using taxonomy hierarchy.

How do I limit the allowed taxonomy terms basing on the content type?

Alireza Tabatabaeian

Views Data export xml

1 month 3 weeks ago

Drupal 10.2.4 php - 8.2.16

I have created a Views Data export xml but the link to the xml file only works when I am logged in. When I'm not logged in the link works, but the xml file is empty. How can I have this link so that non-registered users can also see it. I tried with the xls that is downloaded, but if I am not logged in, an empty file is downloaded. Thanks for any help.

Mihail Novak

Custom views filter to select roles

1 month 3 weeks ago

I have scoured the internet trying to find information on how to achieve this functionality to no avail. I am hoping I can get an answer here.

I have a content type called 'Server' on my website. One of the fields on 'Server' is an 'Access Role' field, which is an entity reference of user roles.

When a new piece of content is made, the author selects one (or multiple roles) that have access to this piece of content (The author can't be granted the 'manage roles' permission, so they can't use the standard 'permissions' options available when creating content).

I have a view setup (that is a REST EXPORT of type key_auth. When a user accesses the endpoint using their auth key, the view should return a list of server content that matches ONLY if one of the users roles is in the access roles field for the piece of content. I can't seem to find out how to achieve this using views and filters.

As an example;

Server 1 Access Roles: Developer, Testing

Server 2 Access Roles: Administrator

The user accessing the endpoint does not have the administrator role, but does have the Testing role. When the user accesses the endpoint, only 'Server 1' should return for them, since that's the only server that matches one of their roles. If more servers matched, those servers would be displayed, too.

I have the access roles setup, and the view setup to connect the api key to the correct user, but can't figure out how to set the filter up to match user roles to one of the possible access roles on the server content.

Is there somebody that could offer me some assistance?

Ex0r

How can I access workflow fields and store them in content fields in drupal

1 month 3 weeks ago

I have a workflow called custom and it has workflow field called assign user , now i am using this workflow on my content type complaints and it is showing the workflow form in a field called field_workflow_state and in the workflow history it is storing the assigned user , now i want to retreive the assigned user and store it in another field called assigned to . I tried many options but none have worked.

Joel Camilleri

Ajax webform: refresh page on a successful submission

1 month 3 weeks ago

I am using the ajax webform, because I don't want the page to be reloaded when the user doesn't enter everything correctly because my form slides in and reloading just causes it to disappear and you would have to navigate back there. When I have ajax-mode enabled, the redirect part works differently, and since the site has only 1 page, it doesn't really do anything, the form doesn't close.

What I want to do it actually refresh the page when the form is submitted with ajax-mode on.

user12078

Drupal Planet

The Drop Times: Drupal is Missing a Comprehensive List of its Features!

1 month 3 weeks ago
Delve into the latest initiative sparked by Andrew Kucharski to transform Drupal's visibility and user perception, addressing the need for a universally accessible features list. This discussion, enriched by insights from tech experts like Alex Dergachev, Ajith T., Dave Smyth, and Anoop John, highlights the community's drive towards showcasing Drupal's extensive capabilities, not just as a developer's framework but as a versatile platform for various business needs. Discover how this collective endeavor sets the stage for a new era in Drupal's market presence and user engagement.