redirection – drupal 9.1.4. in a subdirectory

I have drupal 9.1.4 in the subdirectory “drupal9” because the site is now running from the “drupal7” directory. I have done the installation manually in minimal installation by ftp and make my own theme. Everything works fine when I access the site:
sitename.com/drupal9
Now of course I want it to run from the subfolder, without showing the subfolder name. Until now, drupal 5, drupal 6 and drupal 7 have always worked fine.
Through the information from all kinds of sites I have tried the following:

In the root in a .htaccess file:
RewriteRule ^ $ drupal9 / $ 1 (L)
RewriteCond% {REQUEST_FILENAME}! -D
RewriteCond% {REQUEST_FILENAME}! -F
RewriteRule ^ (. *) $ Drupal9 / $ 1 (L)

In the .htaccess file of the directory drupal9 (of which I doubt if this adds anything):
RewriteBase / drupal9

And in settings.php:
if (isset ($ GLOBALS (‘request’)) and ‘/drupal9/index.php’ === $ GLOBALS (‘request’) -> server-> get (‘SCRIPT_NAME’)) {
$ GLOBALS (‘request’) -> server-> set (‘SCRIPT_NAME’, ‘/index.php’);

After adding this and running sitename.com/update.php I think it should all work.
In fact, it will then be possible to enter the drupal9 site, without the drupal9 folder being visible in the address bar.
However, at that moment I can no longer login to the admin section and subsequent menu links are no longer visible and cannot be accessed via the address bar. I have no idea how to fix this … hope someone can help me.

testing – Basic kernel test in Drupal 9 fatal errors with Type of DrupalKernelTestsCoreEntityEntityKernelTestBase::$modules must be array

Trying to port a Drupal 7 module to 9 with accompanying test and getting this error immediately when running it:

PHP Fatal error:  Type of DrupalKernelTestsCoreEntityEntityKernelTestBase::$modules must be array (as in class DrupalKernelTestsKernelTestBase) in /var/www/html/docroot/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php on line 12

The test:

class MyModuleTest extends EntityKernelTestBase {

  use NodeCreationTrait;

  /**
   * @var DrupalmymoduleQueryYearsQuery
   */
  protected $query;

  /**
   * @var array $modules
   */
  protected static array $modules = (
    'node',
    'mymodule',
    'mymodule_test',
  );

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    ...

I checked around some of the core classes – the $modules declaration looks the same. Note that I am using PHPUnit 9.

7 – Can’t access to my database while installing drupal site

When I très installing my Drupal site, I pass throughout the first 2 steps:language.. when I type the name of database, username and the host(localhost) nothing happends, just the erros username required, database required, host required.
When I look into the error.log, I find this error : XAMPP Error: www.example.com:443:0 server certificate does NOT include an ID which matches the server name.

How can I preprocess Drupal 7 pager links for a view display

I’ve created a custom Drupal 7 block view that uses a mini pager. I need to display the pager-previous and pager-next links as images, and replace the pager-current link with some text. Do I need to create templates for these three links? Do I need preprocess functions for each of them? What are the naming conventions for these templates and functions? They would be tied to a particular block display.

How to set CURL options in a Drupal 8 custom migration?

I have a custom migration that needs to get json from a remote url. This works fine in a beta environment outside of ddev but I’m having trouble in my ddev test environment because of SSL on the other end. The only place I can find any Drupal settings, it seems the curl option SSL_VERIFYHOST is set to false, but that’s clearly not happening when my migration tries to run. I’m using migrate, migrate_tools and migrate_plus; I saw that another module, migration_tools, might allow me to set the curl options but I get a dependency error when trying to enable it. Core and modules are all current versions. Any help would be greatly appreciated.

views – VBO hook_entity_update – Drupal Answers

I would like to perform the following mass action via VBO: send a mail to author of a node.

This mail is configured and sent in a hook_entity_update funtion.

The beginning of the function is the following :

if (is_null($entity)) return;
if (!isset($entity)) return;

$nid = Drupal::routeMatch()->getRawParameter('node');
if ($nid) {
 $type = $node->bundle();
 if ($type != 'membre') {
   return;
 }
}
else if ($nid == null) {
 return;
}

...

$mailManager->mail($module, $key, $to_trsf, $langcode, $params, NULL, $send);

test 1: If I update manually the node, the mail is sent.

test 2: If I update the node through a VBO, the mail is not sent because the nid is null, so the “return” statement is done.

Is there a possibility to retrieve the nid of a node when the hook is fired throught a VBO action?

Regards,
Etienne

taxonomy terms – Is there anyway create relationship for filter criteria which has vocabularies( state, city and location) in views – Drupal 8

list of available Vocabularies in my content type.

  • Country(Term: US)
  • State (Terms: CA , CO, DE.. etc)
  • City (Terms:Fremont, Irwin, Los Angeles, Monument etc..)
  • Location(Terms: All loacations)

I’m trying to create a view for published content result which uses above vocabularies. I need to expose filters to the users where I added above vocabulary fields. How to create a relationship to select particular state->city-> location
(For ex: State(CA)->City(Fremont)->location(xxx-fremont))

Below is the example filter. Please help.

enter image description here

Making unique NID-based identifiers for titles using Bootstrap collapse fields in Drupal 8 Views

I created a view where I’m displaying only one content type, with four titles from content pages, one subtitle, and the content ID (nid) included in the fields for my view. I hid all these fields, and now I’m trying to create a Bootstrap collapse layout in the custom text field.

What is the best way that I can make each title show based on the NID of each content page? Basically, I need the user to be able to click each title, and make something unique show up in each of the 4 titles… For instance, the subtitle field only shows up underneath one particular content title. But so far, when I click ANY title, the subtitle field shows up (it shows up underneath the title that I want it too, but I definitely don’t want it to show up when I click an unrelated title).

I tried creating unique identifiers, as you can see below, but no dice. Any advice is greatly appreciated!

   <p>
     <a class="btn btn-link" data-toggle="collapse" data-target="#collapse-NID" href="#collapse-NID" role="button" aria-expanded="false" aria-controls="collapse-NID">
    {{ title }}
  </a>
</p>
<div class="collapse-NID" id="collapse-NID">
  <div class="card card-body">
     {{ field_file }}
  </div>
</div>


<p>
  <a class="btn btn-link" data-toggle="collapse" data-target="#collapse1-NID" href="#collapse1-NID" role="button" aria-expanded="false" aria-controls="collapse1-NID">
    {{ title }}
  </a>
</p>
<div class="collapse1-NID" id="collapse1-NID">
  <div class="card card-body">
    {{ field_file }}
    {{ field_subtitle }}
    {{ field_file }}
  </div>
</div>

views – Are Drush vbo-execute actions supported in Drupal 9?

I’ve been trying to find an efficient back-end way to delete large numbers of nodes based on some filter criteria to implement data retention policies. I have read that it’s possible to perform actions provided by views bulk operations on results from a view via drush – such as in the answer in the screenshot below (in response to this question).

enter image description here

This seems like a very powerful concept because you can use the selection power of views and do operations on large amounts of data from the server side. I tried to do this on my Drupal 9 site. One discrepancy I noticed is that when I go to add the VBO field, I do not have an option for “Bulk Operations: Content” like is suggested in the above screenshot, rather only the one from the “Global” Category:

enter image description here

I tried using that field anyway, and selected the “Delete selected entities/translations” option and saved the view.

When I try to execute the action from the view using the drush command
drush vbo-execute delete_all_recruitment action::views_bulk_operations_delete_item

I get the following error:

In ViewsBulkOperationsActionManager.php line 169:

  The "action::delete_action" plugin does not exist.

I cannot seem to find this error in any other forum posts, or any documentation from VBO as to how to identify what actions are available. Is this capability for VBO not available for Drupal 9, or is there some knowledge base I have missed that details how to specify the action?

Creating a dev site on subdomain with live site at root in Drupal 9 and Drupal 7

I need to have a copy of my live site install in a subdomain called dev.mydomain.com. But when I connect to that subdomain, the site shown is the one at the main domain, although the url contains the subdomain.

I imagine I need to configure the .htaccess files at both installations properly. Can anyone help me with the right configuration?