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

form_element hook any way to traverse up to find specific form ID

Trying to add a new template for a specific form but need the hook at form_element. I've seen this old post about being unable to access the form within this hook. Any ideas on how I can traverse up somehow? I basically need the suggestion for one form only.

function MYMODULE_theme_suggestions_form_element_alter(array &$suggestions, array $variables, $hook) {
  if ( $variables['element']['#id'] === 'FORMID') {
    $suggestions[] = $hook . '__custom';
  }
}

Search Engine for decoupled data

Is there any way to create a search engine and view for the data which is not stored in the drupal database ?

[Solved] why are Form fields cached in Drupal.

I am developing a custom module in Drupal8. This is my first attempt at module development. Earlier i had some custom php code in the Page itself. 

In Drupal 8 , the PHP format is removed (or not recommended) , i am developing a custom module. 

My module is a form with bunch of fields (textfield, drop down and checkboxes) . 

On submit , i need to go to a Display Page with the results (after some calculation based on the entered fields ) . 

Question on Block Conditions

I have a site that uses the following:

Creating ticket booking module

Hi everyone!

I'm creating a module in Drupal 7 for ticket booking and I need a little help.

I have added a menu link where my newly created module opens up a form and that form needs to have: 

a hidden field for current user

a field with performance title for users to choose from

a field with dates available (this should actually be nested within the performance, but first things first)

a filed with number of tickets that user wants to purchase

Use the user picture to set default image in a node

In a hook for alter, I try to set a default image, that is the user posted picture.

$author = $node->getOwner();

$user = \Drupal\user\Entity\User::load($author->id());

if (!$user->user_picture->isEmpty()) {

   $displayImg = file_create_url($user->user_picture->entity->getFileUri());

   $form['field_avatar']['widget'][0]['#default_image'] = $displayImg;

Pages

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