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

How to add multiple “submit” buttons in Webform

Hello, in Drupal 7, with webform 4.19 module, how can I add multiple working "submit" button that actually submit my webform.

In a custom module, I wrote something like that:

$form['actions']['submit_2'] = array(
  '#type' => 'submit',
  '#value' => t('Submit 2'),
);

A new button appears correctly in my webform (named "Submit 2"). If I click it, it does nothing visible...

If I add a custom handler for this button like this:

Error while renaming the file on upload (file filed)

Hi,

I was trying to rename the uploaded file using the following code, unfortunately it returns an error as PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3343-width' for key 'PRIMARY': INSERT INTO {file_metadata}

please have a look at the code

 

Dependency Injection

Hi,

I have been given a code in which I have been asked to use dependency injection.  The code goes as the following:

class SourceNode extends BlockBase {

/**
* {@inheritdoc}
*/
public function build() {
$build = [];
$sources = '';

How to disable or add permission to an existing route

Hi,

I'm using Drupal 8.7.5.

I want to disable or add permission (only administrator can access) to an existing route , path is /node/add/article  because I've built a new form for creating article, I want editors use the new form instead of the default form at url /node/add/article .

How can I do this?

Thank you

How to create a custom token for the Message module ?

I have a site with Drupal, as well as the modules "Message" and "Token".

I created a custom module based on the module "Message example".

I created for entities, a display mode called message_activity_stream.

I created a token to display the rendered entity of the nodes and it works.

Now I want to create a custom token to display the rendered entity of the author of the message.

Populate the value in an edit form

HI I have a function as follows that returns a form with all the values populated, What I have been doing is then hiding the fields I don't want but was wondering if there is a way to just display the fields I do instead, can anyone assist please, for example how would I display just the title field.

thanks

Pages

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