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

Add new field from configuration

Hello everybody,

I have implemented a content type using configuration export and adding it in a module. So whenever a user installs the module, the content type is created along with the its fields.

What happens if I want to add a new field? If I add a new field to the configuration, it will not be created in the DB until the module is uninstalled and re-installed. How can I add the field in the DB without having to uninstall/re-install?

Thank you in advance for your time.

WebForms Modal

Hey, everybody, I'm new in Drupal. I'm working with version 8 and I've created a form, which when it sends, datas are sent to RESTAPI with remote url handler, and afterword it shows a modal with thank you message. I'm trying to show in the modal window the data that has been sent it in the form but I can't find a way to do it. Can you give me some guidance? Thank you 

Custom Module development

I want to write a custom module that:

Gets the node title that is printed out by a custom view and then passes it inside a json object to a template which prints out the title.

e.g: http://my-drupal-site/my-custom-view/12 prints out the title of the node with node id 12, e.g. "Delish Fish Dish"

Custom Widget Setting

I am currently porting the amazon_pa module to drupal 8: https://www.drupal.org/project/amazon_pa

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

Hi,

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

https://imgur.com/a/CrOHgyM

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.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions