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

Drupal Cache Issue

I want to get the cache object  but i am getting below error. Any help would be appreciated. I have this code in the core\lib\Drupal\Core\Database\Database.php

Code:

\Drupal::cache() ;

Error:

Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer()  

Inject CacheBackendInterface interface in a class to make use of cache

Below is my class and i am trying to inject CacheBackendInterface interface in my class but it is not working. any help please?

<?php

namespace Drupal\Core\Database;

use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use Aws\SecretsManager\SecretsManagerClient;
use Drupal\Core\Cache\BackendChain;
use Drupal\Core\Cache\MemoryBackend;

Modal dialog: (adding extra button to close)

I have created a page and added views block and listing articles from a specific content type. I added a global: Custom text field and added a link that successfully opens a modal_dialog window with the code below.

<a class="use-ajax button" data-dialog-type="modal" href="node/{{ nid }}">open modal</a>

How to set autofill or how to set it? in Drupal webform version 8

Form 1 has three elements:

Webform name: FormLogAC

1. AC Log Number (ac_log_number_mas2) - Text field

2. Building Name (building_name_mas2) - Entity select

3. Room Name (room_name_mas2) - Text field

Form 2 has four elements:

Webform name: activityform

1. AC Log Number (ac_log_number_keg) - Entity select

2. Building Name (building_name_keg) - Text field

3. Room Name (room_name_keg) - Text field

4. Officer Name (officer_name_keg) - Text field

Chatbot with Live Helper Chat

Hello everyone,

I have a question. Is it possible to integrate a chatbot (like Copilot Studio by Microsoft) using Live Helper Chat in Drupal? I have an iframe provided by the Microsoft platform for my Copilot chatbot, and I would like to integrate my chatbot into my website through the Live Helper Chat widget. Do you think this is possible?

Thank you in advance for your responses.

Laura

Unable to fetch taxonomy terms

I have a view where I need to show the taxonomy terms and I'm trying to access the name of the terms in my twig file and I'm unable to fetch using the below code,

{% for row in rows %}

{{dump(row.content['#taxonomy_term'])}}

{% endfor %}

I can traverse only till ['taxonomy_term'] as mentioned in the above dump and if I try to traverse after taxonomy_term it only returns null, but I have the required value in values>name>x-default>"Case Studies" Use the below object for reference.

Pages

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