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

Contact forms - preventing submissions from saving

Anyone have found a way to prevent form submissions from being stored in Drupal? I see there is an option in webforms but I'm using contact forms. We submit to marketo so the submit still needs to go through but any suggestions via hook?

Thanks

EntityQuery, by referenced entities

Hi all, 

I am getting an empty array when I query by the value of a referenced field. 

I have the following:

$result = \Drupal::entityQuery('node')
    ->condition('type', 'custom')
    ->condition('status', 1)
    ->condition('field_category.entity:taxonomy_term.name', 'somevalue', '=')
    // ->condition('field_category.%delta', 'somevalue');
    ->execute();

Using ->condition('field_category.%delta', 'somevalue'); returns way too many results (nids) than expected.

views php

I'm using views php modules.

I use The following code:

<?php global $user; print_r($user->uid); ?>

successfully acquired the current user uid, I tried to use code

<? PHP global $user; print_r ($user - > field_mdtk); ?>

to get an additional field value of the user, but failed, who can tell me how to write the code? I will be very grateful for all the help.

Dependency Injection in Blocks

Here is an example for dependency injection in blocks, please let me know what does the parent::__construct does here.

class MyPluginBase extends PluginBase implements PluginInspectionInterface, ContainerFactoryPluginInterface {

protected $entityManager;

public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) {

How to Change the Title of a Page Dynamically in Preprocess

We have a content type called "store" and we plan to change the title of page to be "{title} review", something like if we put Amazon on the title, on the page it should be "Amazon Review"

We plan to use preprocess_page_title, and below are some of the code:

$node = Drupal::request()->attributes->get('node');

if (isset($node) && method_exists($node, 'getType') && $node->getType() == 'store') {
    var_dump($variables);
    $variables['title'] =  $variables['title'].' Review';
  }

Showing 3 bootstrap modals consecutively - D8

Hi I'm working on a D8 site, developing a custom module that needs to show (required by client) 3 consecutive forms inside modals (one button in modal 1 triggers modal 2 and a button in modal 2 triggers modal 3) I'm using bootstrap theme and using Drupal Modal Dialog Api, all works fine in modals 1 and 2, but for some weird reason, when I try to execute any ajax callback on modal 2 form, modal 2 disappears and it only shows a modal backdrop with the body of modal 1 (without the bootstrap modal wrappers). Have someone faced the same issue with bootstrap modals and Drupal Modal Dialog Api?

Pages

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