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

Problem in routing/ js

Hi everyone

I creat a module. I have my .js file that catch attributes in an IFrame(h5p) with console.log)

When i clear the cache, i go directly to the page that i want and console.log is working( i catch attributes) but when i clear the cache and go to Home page(or any other page in drupal) and then i go to the page that i want, nothing happens (console.log doesn't work).

How to load existing media into a media field programmatically

Hi, I have a content type called Car, where I want to load existing uploaded media programmatically while adding new content when media field is empty. I have the media id number, I tried Media::create by doing so I am getting duplicates of the same image. I tried Media::load by getting media id, its not working. any assistance would be really helpful.

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.

Pages

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