onlyoffice_docspace-1.1.0/onlyoffice_docspace.module
onlyoffice_docspace.module
<?php
/**
* @file
* Primary module hooks for ONLYOFFICE DocSpace Connector module.
*/
/**
* Copyright (c) Ascensio System SIA 2024.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
use Drupal\Core\Field\FieldTypeCategoryManagerInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function onlyoffice_docspace_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.onlyoffice_docspace':
$output = '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The ONLYOFFICE DocSpace Connector allows using the room-based environment for effective document collaboration right within Drupal. Users are able to create Collaboration and Custom rooms with the pre-set access level, edit and co-author all types of office files.') . '</p>';
$output .= '<h3>' . t('Installation and configuration') . '</h3>';
$output .= '<p>' . t('As a Drupal admin, go to Extend -> Add new module and upload the plugin archive. Once done, click Install. To configure the plugin, enter your ONLYOFFICE DocSpace address, administrator login and password. Learn more details on the <a href=":onlyoffice-docspace-drupal">official project page</a>.', [':onlyoffice-docspace-drupal' => 'https://github.com/ONLYOFFICE/onlyoffice-docspace-drupal']) . '</p>';
return $output;
}
}
/**
* Implements hook_theme().
*/
function onlyoffice_docspace_theme($existing, $type, $theme, $path) {
return [
'onlyoffice_docspace_page' => [
'variables' => [],
'template' => 'onlyoffice-docspace-page',
],
];
}
/**
* Implements hook_ENTITY_TYPE_delete() for user entities.
*/
function onlyoffice_docspace_user_delete($account) {
\Drupal::database()->delete('users_docspace')
->condition('uid', $account->id())
->execute();
}
/**
* Implements hook_field_type_category_info_alter().
*/
function onlyoffice_docspace_field_type_category_info_alter(&$definitions) {
$definitions[FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY]['libraries'][] = 'onlyoffice_docspace/onlyoffice_docspace.onlyoffice-docspace-icon';
}
