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

‘Contains’ operator in Drupal webforms

Hello everyone,

Would be really grateful for some assistance.

I have built a Drupal web form and would like to display specific text fields in the form with prepopulated values so they are predefined for users when completing the form. 
 

The default values I need to display are dependent on the previous question in the form so I would need some code like - {if field C contains ‘AB’, display ‘123’ or if field C contains CD, display ‘456}

However there doesn’t seem to be an operator option for ‘contains’ in Drupal webforms? 
 

How to return the relationship values of a field with multiple results on the same line

I have a commerce product, and one of it's fields is "Related products"

Each Product has :

  • An entityID assigned by Drupal (obviously)
  • A title
  • A company assigned unique code (eg.SKU123)

I am building a table to export the products as CSV.

When I display the table, the column "related Products" returns the entity IDs of the related products. I want the SKU.

So, I've made a relationship between the "field_related_products" and the Products.

Get a media entity reference fields value without knowing the field name on node content type

I'm working with a module that provides a media entity type that has a field named 'field_media_video_file' to upload a video file (similar to media video which uses the same field name).

Then for example a node content type where the media field was added as a reference media field "but" the field name on the node is generic like 'field_upload_video' and could be named anything really depending on what the user who initially created the content type names it as the media reference field could be used on any content type. 

reversing alphabetical order of better exposed filter in a page

Hello im trying to reverse the order of a filter put with bef which contains checkboxes of taxonomy term to a content type named news item. The hook i implemented is this:

<?php

Coding Standard for requiring patches in public module

A bit of context before I come to the question: When we build our site with composer install, we use a proxied repository instead of using Packagist and packages.drupal.org directly. This is a recommended approach to protect against Dependency Chain Abuse (Source: OWASP - "CICD-SEC-3: Dependency Chain Abuse"). One Drupal-Module we use has specified patches for a different module and for core in its composer.json file.

Default value for 'sticky on top of lists checkbox'

Hello, i am fairly new to Drupal and i just started experimenting with module development. I want to check sticky on top of lists option by default when creating a Basic Page and i've tried different codes for it but it did not work. Hiding and removing the field from the form are working just fine. i have also tried:

$form['sticky']['#default_value'] = TRUE;

$form['sticky'][0]['#default_value'] = TRUE;

$form['sticky']['#default_value'] = 1;

Hook implemented:

Pages

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