1 views.install views_update_1004()

Replace the frontpage view with promoted.

Related topics


core/modules/views/views.install, line 132
Contains install and update functions for Views.


function views_update_1004() {
  // If the old frontpage view is still disabled, delete it.
  if (config_get('views.view.frontpage', 'disabled') === TRUE) {
    $config_frontpage = config('views.view.frontpage');
  // See if there is already a promoted view on this site.
  $config_promoted = config('views.view.promoted');
  if ($config_promoted->isNew()) {
    // If not, create the new promoted view and mark it disabled.
    $path = backdrop_get_path('module', 'node') . '/config/';
    $contents = file_get_contents($path . 'views.view.promoted.json');
    $data = json_decode($contents, TRUE);
    $config_promoted->set('disabled', TRUE);