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

Drupal Gap

How can I get more information on DrupalGap? Would using it be recommended? The community seems very small and not very active right now.

Ordering in mysql query giving syntax error

Hi,

I am trying to order my query like so:

$query = db_query("SELECT * FROM `heritage_source_info`WHERE text_id = :textid AND format = :format ORDER BY type ASC", [':textid' => $textid, ':format' => 'text'])->orderBy('FIELD(type,moolam,translation,commentary)');

$available_sources_text = $query->fetchAll();

But it says call to an undefined function orderBy(). Could you help me with the correct syntax?

Thanks

Custom modules are cached after Drupal 8.9 or 9.0

After upgrading to Drupal 8.9 or 9.0 all my custom modules always give the last result as if it's fully cached. I'm logged in as the admin user. On another web browser I get the same cached result.

I quickly wrote a simple module that shows the GET variables, a random number and the first line of a text file.

Each time I start it I get the same output. If I clear all caches in /admin/config/development/performance, I get one time the correct new data.

Until Drupal 8.8.6 all worked fine.

Tested with:

Do derivative plugin block names need to be unique machine names?

Hoping someone might be able to answer this for me. I have a custom module making use of derivative plugin blocks and not sure which one of these are the correct way to ensure the block names are unique:

Option #1) Do I simply save each newly created derivative plugin block name into the config entity using standard textfield and perhaps build my own method for ensuring that the derivative plugin block name is unique (not already in use)?

How can I make email field required

How can I make email field required in add user page (admin/people/create) ?

I tried this in form alter:

$form['mail'] = [
'#required' => TRUE,
];

and this as well

$form ['mail']['widget'][0]['value']['#required']=TRUE;

But didn't work, even when I dump($form), its not showing mail,

Please help me its urgent, I stuck from long time in this.

Do derivative plugin blocks need to have their own unique machine name?

Quick Drupal 8 question as I'm a bit confused and hoping someone can clarify this. I have a custom module which makes use of a derivative plugin and as you can see from the code below I currently have the block ID's and labels hard-coded. But I plan on creating an config entity form to let users define their own block ID's/labels.

Pages

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