Drupal 8: How to redirect to batch form after submit to custom url (batch api)

I’ve been fighting with this for a long time but then I found simple solution.

I needed to redirect to new batch processing page right after clicking submit button so here is a solution

public function submitForm(array &$form, FormStateInterface $form_state) {
    $form_state->setRedirectUrl(Url::fromUri())
    $identity = isset($form_state->getTriggeringElement()['#identity']) ? $form_state->getTriggeringElement()['#identity'] : 'unknown';
    switch ($identity) {
      case static::BTN_UPDATE;
        $batch = [
          'title' => t('Updating'),
          'operations' => [
            array('sfo_common_batch_callbacks__taxonomy_update_cache_process', [[]]),
          ],
          'finished' => 'sfo_common_batch_callbacks__taxonomy_update_cache_finished',
          'file' => drupal_get_path('module', 'sfo_common') . '/include/batch/sfo_common.taxonomy_cache.inc',
        ];

        batch_set($batch);
        $request =  batch_process(static::URL_REDIRECT);
        return $request->send();
        break;
      default:
        drupal_set_message(t('Incorrect operation'));
        break;
    }
  }

This is the usecase I found. But this is only works great for batch. If you need to redirect after form submit it is also possible to use

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_state->setRedirect(taxonomy.vocabulary.collection); // Here need to pass route name from *.routes.yml file

  //But if you need to redirect to custom url
  $form_state->setRedirectUrl(Url::fromUri('http://google.com')); // Need to pass Drupal\Core\Url object here
}

Other ways to redirect https://www.drupal.org/node/2023537

Loading

Posted in Nets, PHP, WEB, The Internet, Computers, BY, Programming | Tagged , , , | Leave a comment

Electro Sun – Pure Blue (2005) (FLAC, 16bit/48kHz)

Fullon slightly different from the distant 2005 year. More of this will not be Fullon, take, while there is.

2240932

Electro Sun - Pure Blue (2005)

Loading

Posted in Audio, Music, Play online | Tagged , , , , , , | Leave a comment

The original and unexpected gift to 8 Martha

cut-flowers-kill-quote-Favim.com-3085649

(We cut and kill flowers, because they are beautiful, but at the same time, we cut and kill their own kind, because they do not like us)

Prelude

In general, recently I had a discussion on the topic of, What to give the girls on different occasions, whether 8 March or any Housewarming, her birthday Kitty cat or something else. Most people do not care, they are going to give, because it is a habit, because every year there is one and the same. Usually, All have become accustomed to getting all sorts of ties, shaving foam and every perfume delusional, special, if you perfume gives your girl, then just do not use this acid mixture, because the, if you appreciate your girl (not that, my), it will give you the most disgusting smell perfume, because these snakes are cunning and clever, they do not want, to your subtle scent of perfume stuck to other females (or males, that true now). Continue reading

Loading

Posted in Cognitive, Miscellaneous, Philosophy | Tagged , , , , , , , , , , , , , , | Leave a comment

Windows 7: The endless search for updates

Prelude

Today put on a laptop Windows system 7 from scratch, and I come face to face with the problem, when Windows for a long time looking for updates. My search logs, of pressing keys “reset” and even swear words – did not help, but helped Google, so now we have to write it here! Because I did not immediately find the solution to the problem. First, I came across a couple of forums, where the super geniuses advised to re-establish vindous, remove antivirus, run with a tambourine, IT specialist and call a friend to give him a royal blowjob, or take in a service center, which will be exactly the same search in Google solution to this problem.

Solution

Now! For the magic solution to this problem need to just download something update KB3102810 (Direct links: Windows 7 x86|Windows 7 x64)

I want to thank dude, who wrote article, that helped me.

Reference

Loading

Posted in Nets, The Internet, Computers, BY, System Administration | Tagged , , , , , , | 15 Comments

Safe To Say – December (MP3, 44100kHz, 256kbps)

On the eve of expiring December spread the excellent metal-pop track with translation

December
December

 

I can feel it in my conscious, I can feel it in my heart,
I tried everything, it’s time for me to start
Being the change that I wanted to see
I filled my life with waste but now I feel free.

I’m taking a step back, I’m taking some time to think,
About everyone and everything we were
I’m opening up my eyes, I’m letting down my guard
I’m leaving everyone and everything we were.
Everything we were

The reason why why you’re smiling
Is beacuse you understand, we are here we are now,
It’s everything we ever had
I never stoped believing in what we could do,
So put your head up and spread love like fire

I’m taking a step back, I’m taking some time to think,
About everyone and everything we were
I’m opening up my eyes, I’m letting down my guard
I’m leaving everyone and everything we were. (x2)

I am aware of the mind,
I feel it in my heart -
I tried everything, it's time to start
Be the very change, I always wanted to see,
My life was filled with unnecessary load, but now I feel free.

I take a step back, I need some time, to think
About all and all, what we were.
I open my eyes, disable its protection,
I leave everything and everyone, what we were,
All, what we were.

You are smiling,
Because you know - we are here and now,
And this is, that we have ever had.
I never stopped believing in the, that we could do,
So raise your head up and sprayed love like a flame!

I take a step back, I need some time, to think
About all and all, what we were.
I open my eyes, disable its protection,
I leave everything and everyone, what we were,
All, what we were,
I leave everything and everyone, what we were,
All, what we were.

the translation of the author: P1ratRuleZZZ

Loading

Posted in Audio, Play online | Tagged , , , , , , | Leave a comment

HIM – And Love Said No… [UK Edition] (2004, AAC 44100kHz, 512 kbps)

AAC 512kbps/44100Hz

Loading

Posted in Audio, Music, Play online | Tagged , , | Leave a comment