This forum is for module development and code related questions, not general module support. For general support, use the post installation forum.

Custom Widget Setting

I am currently porting the amazon_pa module to drupal 8:

The widget has a custom setting called locale. Meaning it is a select box here: /admin/structure/types/manage/article/fields/node.article.field_amz/storage

I am not able to save the vale i input there. So what one has to do that the form element $element['locale'] is actually saved and can be retrived late?

Thank you very much.

How do I hide/show admin links based on user role using a custom module?

Here is the code I have so far in my custom module:

/* Only show certain admin links based on user role */

function cms_tweaks_tt_content() {

global $user;

if (in_array('tt_content', array_values($user->roles))) { echo '<script type="text/javascript">' . 'document.getElementbyID("tt_content").style["display"] = "block";' . '</script>';

} else {

Issue with Custom page with two forms and url parameters


I have two forms displayed on a custom page. Both the forms are displayed in Blocks, like this:

After the submit button is clicked, each form adds a parameter to the url, so that it could be retrieved in the Controller code. Both forms are also redirected to the Custom page after submit.

Custom Access Check

I have created a custom access check as described in this link ( I also create custom menu link linked to a route which uses the access check, so therefore if they do not have access, it will not appear.

However, I have noticed that when I am logged in as an admin, this access check is being skipped, showing the link.

Access keys of a Json object in a twig file


I have a REST response that looks like this:

    [0] => Array
            [nid] => 24503
            [title] => 13.10
            [field_gita_10589_text] => Array
                    [content] => some value



the key [field_gita_10589_text] is not fixed, and will change depending on checkboxes selected on a form. 

I have a twig file in which I am accessing the field_gita_10589_text.content like this:

Storybook for Drupal

So, I've been working on using Drupal as a story archive (Fanfiction) since I found the project several years ago. ANd now I'm trying to create a module that takes all the configuration I would do for a page to present story related content and offer it up.

I of course want to keep the dependencies down, or keep the number of non-core dependecies to a minimum. Right now it's looking like I will absolutly have to have paragraphs, as I want to ensure a person can create a story with a full layout, or add illustrations to a page. Even have a few entries that are just comics. 


Subscribe with RSS Subscribe to RSS - Module Development and Code Questions