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

Default value for 'sticky on top of lists checkbox'

Hello, i am fairly new to Drupal and i just started experimenting with module development. I want to check sticky on top of lists option by default when creating a Basic Page and i've tried different codes for it but it did not work. Hiding and removing the field from the form are working just fine. i have also tried:

$form['sticky']['#default_value'] = TRUE;

$form['sticky'][0]['#default_value'] = TRUE;

$form['sticky']['#default_value'] = 1;

Hook implemented:

settings.php: config() vs. configFactory()

Setting locale's translation path in settings.php works like this:

$config['locale.settings']['translation']['path'] = 'mypath';

On a freshly installed Drupal 10.2.1 installation, this leads to an empty edit field in admin/config/media/file-system. Because of that, you can't save the form (mandatory field) to save other options.

Am I not doing enough here? Should I call

Correct way to increase allowed file upload size Drupal 10 PHP 8.2

When searching online I have seen multiple answers to this question and I wondered if anyone could tell me the correct way? php.ini? cpanel? Drupal configuration? Apologies for such as basic question but I'm learning. Thanks!

Issue with drupal 10 CSRF token

I have created a Rest API to create a user after success full user creation created CSRF token for the further user access. created csrf token using below core functions. using get() - function i am able to get a csrf token.
public function get($value = '') {

    $seed = $this->sessionMetadata->getCsrfTokenSeed();

    if (empty($seed)) {

      $seed = Crypt::randomBytesBase64();

      $this->sessionMetadata->setCsrfTokenSeed($seed);

    }

    return $this->computeToken($seed, $value);

  }

Bypass X-CSRF-Token validation

Is there a way where we can skip the drupal 10 default xcsrf token validation and alternatively can add the token programatically.

X csrf token on drupal 10

I have been trying to integrate the xcsrf token and when i integrated with my Rest API it is not working as expected

1. method

Core service = \Drupal::service('csrf_token')->get();

2. method

          $url = Url::fromUri('base:/session/token', ['absolute' => TRUE])->toString();

          $response = \Drupal::httpClient()->get($url);

          $user_csrf = $response->getBody()->getContents();

          $csrf_token = trim($user_csrf);

Pages

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