You are here

function maestro_update_8004 in Maestro 8.2

Same name and namespace in other branches
  1. 3.x maestro.install \maestro_update_8004()

Update 8004 - Create new view for Maestro Completed Tasks.

File

./maestro.install, line 115
Install, update and uninstall functions for the Maestro module.

Code

function maestro_update_8004() {
  $message = NULL;
  if (\Drupal::moduleHandler()
    ->moduleExists('views') && !View::load('maestro_completed_tasks')) {
    $config_path = drupal_get_path('module', 'maestro') . '/config/install/views.view.maestro_completed_tasks.yml';
    $data = Yaml::parse(file_get_contents($config_path));
    \Drupal::configFactory()
      ->getEditable('views.view.maestro_completed_tasks')
      ->setData($data)
      ->save(TRUE);
    $message = 'The new Maestro Completed Tasks view has been created.';
  }
  else {
    $message = 'Not creating the Maestro Completed Tasks view since it already exists.';
  }
  return $message;
}