Loading drowl_media.install +5 −3 Original line number Diff line number Diff line <?php use Drupal\views\Entity\View; use Symfony\Component\Yaml\Yaml; /** * @file * Install, update and uninstall functions for the DROWL Media module. Loading Loading @@ -382,7 +384,7 @@ function _drowl_media_install_replace_view_media_library(&$sandbox) { $message .= "\n"; $view_id = 'media_library'; // Only delete the old view, if it is existing. if (\Drupal::moduleHandler()->moduleExists('views') && \Drupal\views\Entity\View::load($view_id)) { if (\Drupal::moduleHandler()->moduleExists('views') && View::load($view_id)) { // Delete the old view $oldViewConfig = \Drupal::service('config.factory')->getEditable('views.view.' . $view_id); $oldViewConfig->delete(); Loading @@ -394,8 +396,8 @@ function _drowl_media_install_replace_view_media_library(&$sandbox) { // Only create if the new view doesn't exist and views is enabled. $config_path = \Drupal::service('extension.list.module')->getPath('drowl_media') . '/config/optional/views.view.' . $view_id .'.yml'; $data = \Symfony\Component\Yaml\Yaml::parseFile($config_path); if (\Drupal::moduleHandler()->moduleExists('views') && !\Drupal\views\Entity\View::load($view_id) && !empty($data)) { $data = Yaml::parseFile($config_path); if (\Drupal::moduleHandler()->moduleExists('views') && !View::load($view_id) && !empty($data)) { \Drupal::configFactory()->getEditable('views.view.' . $view_id)->setData($data)->save(TRUE); $message .= 'The new "' . $view_id . '" view has been created.'; } Loading Loading
drowl_media.install +5 −3 Original line number Diff line number Diff line <?php use Drupal\views\Entity\View; use Symfony\Component\Yaml\Yaml; /** * @file * Install, update and uninstall functions for the DROWL Media module. Loading Loading @@ -382,7 +384,7 @@ function _drowl_media_install_replace_view_media_library(&$sandbox) { $message .= "\n"; $view_id = 'media_library'; // Only delete the old view, if it is existing. if (\Drupal::moduleHandler()->moduleExists('views') && \Drupal\views\Entity\View::load($view_id)) { if (\Drupal::moduleHandler()->moduleExists('views') && View::load($view_id)) { // Delete the old view $oldViewConfig = \Drupal::service('config.factory')->getEditable('views.view.' . $view_id); $oldViewConfig->delete(); Loading @@ -394,8 +396,8 @@ function _drowl_media_install_replace_view_media_library(&$sandbox) { // Only create if the new view doesn't exist and views is enabled. $config_path = \Drupal::service('extension.list.module')->getPath('drowl_media') . '/config/optional/views.view.' . $view_id .'.yml'; $data = \Symfony\Component\Yaml\Yaml::parseFile($config_path); if (\Drupal::moduleHandler()->moduleExists('views') && !\Drupal\views\Entity\View::load($view_id) && !empty($data)) { $data = Yaml::parseFile($config_path); if (\Drupal::moduleHandler()->moduleExists('views') && !View::load($view_id) && !empty($data)) { \Drupal::configFactory()->getEditable('views.view.' . $view_id)->setData($data)->save(TRUE); $message .= 'The new "' . $view_id . '" view has been created.'; } Loading