file_management_view.install in File Management 8
Install, update and uninstall functions for the file_management_view module.
File
modules/file_management_view/file_management_view.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the file_management_view module.
*/
/**
* Implements hook_install().
*/
function file_management_view_install() {
// Disable the existing files view since we add our own view.
$files_view = \Drupal::entityTypeManager()
->getStorage('view')
->load('files');
if (!empty($files_view)) {
$files_view
->setStatus(FALSE);
$files_view
->save();
}
}
/**
* Implements hook_uninstall().
*/
function file_management_view_uninstall() {
// Remove our own view.
$file_management_view = \Drupal::entityTypeManager()
->getStorage('view')
->load('file_management');
$file_management_view
->delete();
// Re-enable the existing files view.
$files_view = \Drupal::entityTypeManager()
->getStorage('view')
->load('files');
if (!empty($files_view)) {
$files_view
->setStatus(TRUE);
$files_view
->save();
}
}
Functions
Name | Description |
---|---|
file_management_view_install | Implements hook_install(). |
file_management_view_uninstall | Implements hook_uninstall(). |