New answers tagged

2

You should be able to do it like this: <?php use Drupal\taxonomy\Entity\Vocabulary; /** * create vocabulary testname. */ function ent_create_update_8105(&$sandbox) { $vid = 'testname'; $vocabulary = Vocabulary::load($vid); if (!isset($vocabulary)) { Vocabulary::create([ 'vid' => $vid, 'description' => '', 'name' =...


0

The core issue for this is Add AJAX support to fields using Dynamic Views Arguments via Tokens, but at the time of this writing the only option available without custom coding is Business Rules' dependent field functionality. However, there are still unresolved problems with multi-valued fields. See Multi-valued dependent child fields are not saved for ...


0

Just tried it out myself and for me it didn't work using your malformatted #attributes array. After I fixed it the following did work. class must provide another array. /** * Implements hook_ENTITY_TYPE_view(). */ function MYMODULE_node_view(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\...


1

Is there any way to tell PHPCS that the function is an AJAX-callback (so that such warnings are generated)? Yes, it's as simple as implementing hooks except that instead of "Implements hook_", it starts with "Implements callback_". The only problem is that currently (August 2019) it is not supported by Drupal's PHPCS standard and you don't get any warnings ...


2

There might be hundreds of ways to add this markup in Drupal. The two simplest that came to my mind are: 1) Add a suffix to the form tag in form build or form alter: $form['#suffix'] = '<div>Suffix to form</div>'; 2) or add the markup in a form.html.twig below the form tag: {# /** * @file * Default theme implementation for a 'form' element. ...


Top 50 recent answers are included