How do i run the equivalent of single configuration import from a hook?

Solutions

 if (\Drupal::moduleHandler()->moduleExists('views') && !View::load('view_name')) {
    $config_path = DRUPAL_ROOT.'/configurationpathto/views_view_view_name.yml';
    $data = Yaml::parse($config_path);
    \Drupal::configFactory()->getEditable('views.view.view_name')->setData($data)->save(TRUE);
  }

Similar questions

How to run code after hook_node_delete has completely run?
I have a node to which I have a number of images attached through the usual content type image field mechanism. The attachment is done correctly, such that when I delete the node, the images are also deleted. My problem is that these images are held in a subdirectory, which is not deleted by the file deletion process, and I end up with a bunch of e...
Run a Drupal website offline (┬▒without server)? --- E.g. hand it over on a usb-stick / by mail? --- Run it from the HD, while retaining functionality?
Since I use free webhosting, I don't have 100% up-time, so I started wondering whether I could maintain such Drupal functionality, while at the same time working offline. E.g., my own quest at the moment: I want to let people fill in a couple of words/lines on a Drupal website by clicking on hyperlinks at specific points in a HTML article which is ...
How do I create a rule to run during every cron run?
I'm creating rules for posting to twitter. However I need these rules to run every time cron runs. What is the best way to structure these rules so they send the appropriate post at the appropriate time?
How to run alterRoutes on particular condition ? Does it run on cache clear and not on normal Request?
I am trying to implement a feature where I need to run different flow than default flow while the registering user on the site. I am trying to alter the route of "user password reset" for the for the first time logging users, Below is the code The problem is that above alterRoute method doesn't runs on the URL hit. It only runs on cache. But my pro...
How do I run queries against a view configuration
Where is all the config for Views stored? I am working on a Drupal site with a very large number of Views. What's the easiest way to find "All the Views which have a Relation of a certain type", or "All the Views which output a specific field?" It would be nice to do this with some SQL but I'm stumped as to how.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.