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

THIS FORUM IS NOT FOR "What module..." or module support questions-- it's for module development and code related questions.

The module development and code questions forum is intended to aid those who are developing modules or writing code for Drupal.

Please note that this forum is also not intended for "Is there a module that does..." or "I need help with module x..." questions. It's also not a place to ask developers to write your code for you. Please respect this.

Please do not post general discussions intended to target module developers. If the question you have isn't specifically related to writing a drupal module, please post it in a more appropriate forum.

  • If you you have drupal installed already and are seeking a module that does a specific task, have a question about a specific module and what it does or if it will fit your use case, please place your questions in the Post installation forum.
  • If you have a problem or question about a specific module, you should create an issue in the module's issue queue (after checking for an existing issue first).
  • If you don't have drupal installed yet, please place your questions in the Before you start forum.

Select option for languages in custom forms

Hi,

I am trying to add a field where the languages could be selected from list of available languages in Drupal 8. The code to handle the language dropdown looks like:

$form['text_info']['fieldset']['source_formats']['selected_langcode'] = [
'#type' => 'language_select',
'#title' => $this->t('Language'),

'#languages' => \Drupal::service('language_manager')->getLanguages(),
];

But the form field is showing as (I have a screenshot):

Proper way to override a method in a Drupal/Core class

I am relatively new to developing with Drupal, and I hoped to get some information on the best way to approach a simple problem.

In efforts to add support for entity labels containing parentheses, I would like to alter the method call extractEntityIdFromAutocompleteInput($input) in the \Drupal\Core\Entity\Element\EntityAutocomplete class.  

D8 - Rest API - Taxonomy with hierarchy

In Drupal 8 (8.7.6), I would need to import several terms in a taxonomy dictionary. It is easy to create the terms at the “root” level, but when I try to create a term with a parent, the term is not created under the parent (but in the root).

Do you have any idea on how to solve the issue?

Thanks

creating a functionnality to refresh page when clicking on a button

hi, 

everything is in the title, I want to create a button that refreshes the page. I've checked on internet, but it's absolutly unclear to me mostly because I don't know how to integrate Javascript within a drupal 8 module. 

I guess other people's have being througth that. Could anyone of them help me ? 

cheers

Database query

Hello, I want to do a very basic query in my my_module.module  but i can't solve it. Someone could help me ?

I want to make an update of my table only for the more recent entry for a specified user. In sql, something like this :

UPDATE table
SET used = 'false'
WHERE bid = (SELECT MAX(bid) FROM table
WHERE uid = 1)

But I don't find any way to do this in drupal 8.

Thanks in advance.

PS: sorry for my bad english

Pages

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