Drupal8 generate a path alias for redirection

    $path = '/node/YOURNID';
    $alias = \Drupal::service('path.alias_manager')->getAliasByPath($path);
    $response = new RedirectResponse($alias);
    $response->send();
    return;

drupal 8

hi,

I'm new with drupal ..i have installed it and i'm working on a cite as my practice to learn but i have a question..if i want to start a new one simultaneously of existing one should i reinstall drupal? or does it have another way?

user restrictions for individual page

Is it possible in Drupal 8 to assign a user content-editing-rights only to an individual page?

Feel free to point me to an existing forum. I did search but possibly didn't use the right keywords. 

drupal 8 form submit redirection

I'm looking on how to redirect after a form submit. I tried the following but it does not work, it tells me that the route does not exist:

    public  function submitForm(array &$form, FormStateInterface $form_state){
          $url = Url::fromRoute('/mon-profil/obtenir_document'); // == /node/1
          $form_state->setRedirectUrl($url);

     }

Upgrading to 8.4 [Part Deux]

I am relatively new to Composer. I just upgraded from 8.3.7 to 8.4.0 after reading every entry on upgrading in this forum. My site now is totally down. I have had to restore from a backup. Here are the steps that I followed. Can someone point out what the problem might be?

The steps that I followed:

1) Renamed composer.lock, core and vendor to _composer.lock, _core and _vender, respectively.

2) Added "drupal/core": "~8.4" to my composer.json. (see below for my composer.json file).

3) $composer update --with-dependencies

How do I create a Y (year only) datetime field?

It's possible to create a datetime field with a constant such as Y-m-d\TH:i:s (date and time) or Y-m-d (date). I want to create a Y (year only) datetime field. To my great disappointment, this is no longer possible in Drupal 8. Do you have any idea how I can create such a field? I know the Years Only module but I don't want to use it since it's not safe. Is it possible to write a theme function for instance?

Pages

Subscribe with RSS Subscribe to RSS - Drupal 8.x