You are here

function file_browser_update_8003 in File Entity Browser 8

Updates the file browser view to only show permanent files.

1 call to file_browser_update_8003()
file_browser_update_8004 in ./file_browser.install
Updates alpha1 users to use the correct View machine name.

File

./file_browser.install, line 153
Defines library requirements and install routines for File Browser.

Code

function file_browser_update_8003() {

  /** @var \Drupal\views\Entity\View $view */
  if ($view = View::load('file_entity_browser')) {
    $display =& $view
      ->getDisplay('default');
    $display['display_options']['filters']['status'] = [
      'id' => 'status',
      'table' => 'file_managed',
      'field' => 'status',
      'relationship' => 'none',
      'group_type' => 'group',
      'admin_label' => '',
      'operator' => 'in',
      'value' => [
        1 => '1',
      ],
      'group' => 1,
      'exposed' => FALSE,
      'expose' => [
        'operator_id' => '',
        'label' => '',
        'description' => '',
        'use_operator' => FALSE,
        'operator' => '',
        'identifier' => '',
        'required' => FALSE,
        'remember' => FALSE,
        'multiple' => FALSE,
        'remember_roles' => [
          'authenticated' => 'authenticated',
        ],
        'reduce' => FALSE,
      ],
      'is_grouped' => FALSE,
      'group_info' => [
        'label' => '',
        'description' => '',
        'identifier' => '',
        'optional' => TRUE,
        'widget' => 'select',
        'multiple' => FALSE,
        'remember' => FALSE,
        'default_group' => 'All',
        'default_group_multiple' => [],
        'group_items' => [],
      ],
      'entity_type' => 'file',
      'entity_field' => 'status',
      'plugin_id' => 'file_status',
    ];
    $view
      ->save();
  }
}