Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
I have successfully added several fields to the product page in the admin panel, but I cannot save the values to use them in the future. What do I need to do?
$form_state->getFormObject()->getEntity() does not work in Drupal 7, similarly to $form_state->setValue() and $form_state->getValue().
What should I add to the code for this to work? How i can save values from this select fields?
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()
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;