function node_post_update_glossary_view_published

Same name and namespace in other branches
  1. 8.9.x core/modules/node/node.post_update.php \node_post_update_glossary_view_published()

Add a published filter to the glossary View.

File

core/modules/node/node.post_update.php, line 24

Code

function node_post_update_glossary_view_published() {
    if (\Drupal::moduleHandler()->moduleExists('views')) {
        $view = View::load('glossary');
        if (!$view) {
            return;
        }
        $display =& $view->getDisplay('default');
        if (!isset($display['display_options']['filters']['status'])) {
            $display['display_options']['filters']['status'] = [
                'expose' => [
                    'operator' => '',
                    'operator_limit_selection' => FALSE,
                    'operator_list' => [],
                ],
                'field' => 'status',
                'group' => 1,
                'id' => 'status',
                'table' => 'node_field_data',
                'value' => '1',
                'plugin_id' => 'boolean',
                'entity_type' => 'node',
                'entity_field' => 'status',
            ];
            $view->save();
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.