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

View custom field showing first char of each array element rather than each array element in Drupal 7

I have a module that queries for a specific webform submission data and sends an array of the results to the view. 
When I dpm the array before the return, it shows what I would expect. An array of strings. In my view, I am getting only one field object and it is the first letter of each element in my array. I was expecting to see a field list of each element in the array

SQL syntax error when querying anything from the database in module

Hi, I am trying to run a query in a custom module to get submissions from a web form. I am new to Drupal and Drupal database queries; but not new to databases and queries. My queries work in phpMyAdmin. I am working on a project that is in Drupal 7. I have tried many examples from Drupal documentation but every query I try I get:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM node node' at line 3

Problem writing Migrate tests using MigrateDrupal7TestBase

I am working on adding Migrate support to the Poll module. Progress and patches can be seen in this issue: https://www.drupal.org/project/poll/issues/2638406

How do I get to set the values of the entity reference fields on a new form

Hi all,

I have created 2 custom content types. The first (i.e. A) has three entity reference fields of the second content type (B).

In my custom module, I am trying to set the values of some fields of B when adding a new A content, but the

$form['field_my_B_1_field']['widget'][0]['inline_entity_form']['#default_value']

is null in the 'my-module_form_alter' hook.

Pleaseeeee, how do i get to set the values of the entity reference fields on a new form (the one when adding a new node of content of type A) ?

Thank you in advance.

How to learn...

Hi All,

Whats the best way to learn drupal module development?

I am guessing this comes up a fair bit.  But if I was looking to learn drupal 8 module development, does anyone have any recommendations for books to learn from?  Or am I better off with online courses?

I am currently going through the freecodecamp tutorials (which don't cover PHP nevermind drupal module dev).  Therefore I am a complete new comer to Drupal (although I did dabble making a module under Drupal 5),

Any advice highly appreciated!

Thanks in advance,

Mark.

Add "Save & Send Email" button to both node add and node edit forms of a content type

Hi,

I am trying to add a "Save & Send Email" button to both the Node Add and Node Edit forms of a Content Type to give the Current User the option of sending themselves an email after saving the content.  I have put together code that works to add the button and to generate the email, but I cannot figure out how to have the button (#submit) trigger sending the email.  Could someone please help me tie them together?  I am also not sure how (if?) to implement both the hook_entity_insert and hook_entity_update in the same module.  The code I have so far is:

Pages

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