How to integrate Drupal with ONLYOFFICE Docs on Ubuntu

1. Overview

Duration: 3:00

If you are running a website created and maintained with Drupal, a popular open-source content management system (CMS), you might want to add new functionality and customize your Drupal platform. Drupal is equipped with some great default features, like easy content authoring and advanced security, but its modularity is what makes it truly unique. With thousands of projects, also known as Drupal modules, contributed by third-party developers, you can make your platform more powerful and scalable.

To enable document editing and real-time co-authoring within your Drupal platform, you can install ONLYOFFICE Docs on your Ubuntu machine and integrate it with your content management solution by activating the corresponding ONLYOFFICE module. ONLYOFFICE Docs is an online office package that is publicly available on GitHub under the terms of the GNU AGPL v3.0 license. This open-source suite comes with a set of collaborative editors and viewers for text documents, spreadsheets, presentations, fillable forms and PDF files. ONLYOFFICE Docs is completely compatible with Open Office XLM (DOCX, XLSX and PPTS files).

The ONLYOFFICE online suite allows you to collaborate on documents in real time within a number of file-sharing services, e-learning platforms and electronic document management systems (DMS), including Nextcloud, Seafile, WordPress, ownCloud, Chamilo, Confluence, Alfresco, Nuxeo, Moodle, etc.

The recently released version 7.2 of ONLYOFFICE Docs makes the Drupal integration more powerful due to a new plugin manager. ONLYOFFICE plugins allow you to enable new features, like translation, grammar correction and communication, in the ONLYOFFICE editors. Starting from version 7.2, you can automatically install and delete plugins with a couple of clicks. Other updates include new interface themes (Dark Contrast and Same as System) and languages, ligatures, new field types and parameters in fillable forms, OLE spreadsheets, etc.

In this guide, we will tell you how to integrate ONLYOFFICE Docs with Drupal and how to use the ONLYOFFICE editors within the Drupal platform.

What you’ll learn

This guide describes how to connect ONLYOFFICE Docs to the Drupal content management platform on Ubuntu via an official integration app to allow Drupal users to edit and collaborate on documents, spreadsheets and presentations in real time.

What you’ll need

  • ONLYOFFICE Docs instance (free Community Edition or paid Enterprise Edition)
  • Drupal instance (if you don’t have one, you can get the latest version from the official website)
  • ONLYOFFICE integration app for Drupal

2. Install ONLYOFFICE Docs

Duration: 10:00

For successful integration, you need to have an instance of ONLYOFFICE Docs (ONLYOFFICE Document Server). Importantly, your instance should be resolvable and connectable both from Drupal and any other end clients. Additionally, ONLYOFFICE Docs must be able to POST to the Drupal instance directly.

The easiest way to get the Community version of ONLYOFFICE Docs is GitHub. You can also read this guide and choose one of the installation methods, the Docker script or the DEB package.

3. Add and enable the ONLYOFFICE module

Duration: 5:00

The easiest way to install the ONLYOFFICE module is to use Drupal’s User Interface. To do so, you need to access on the Admin toolbar project page, go to the ONLYOFFICE module’s page and copy the “tar.gz” link under the Downloads section at the bottom of the page.

After that, you need to visit the Extend page (admin/modules) in the Manage administrative menu. Then click Install new module and paste the already copied link in the Install from a URL field. Finally, click Install to upload and unpack the ONLYOFFICE module. For further information, visit the official Drupal website.

To enable the installed ONLYOFFICE module, go to the Extend page via the Manage administrative menu, find the ONLYOFFICE Connector module and check the corresponding box. Then click Install to enable this module

Another way is to install the ONLYOFFICE module via Composer. For this purpose, you need to run this command in the command line:

composer require drupal/onlyoffice

To enable the ONLYOFFICE module, you can also use the command line. Just enter the following Drush command:

drush pm:enable onlyoffice

After that, you need to follow the instructions you will see on the screen.

4. Configure the ONLYOFFICE module

Duration: 5:00

To configure the ONLYOFFICE module, you need to access the ONLYOFFICE settings located on the ~/config/system/onlyoffice-settings page. On this page, you need to enter the following URL address to connect to the ONLYOFFICE Document Server:


This must be the name of the server where the ONLYOFFICE Document Server is installed. The address must be accessible from the Drupal server, and the address of the Drupal server must also be accessible from the ONLYOFFICE Document Server.

To restrict access to ONLYOFFICE Document Server for security reasons, you can specify the Secret key on the same page. This Secret key must be also specified in the ONLYOFFICE Document Server configuration file to enable validation.

5. How to use ONLYOFFICE Docs within Drupal

Duration: 5:00

With ONLYOFFICE Docs integrated with Drupal, you can:

  • Edit DOCX documents, XLXS spreadsheets and PPTX presentations;
  • Open other formats (for example, DjVu, DOC, EPUB, FB2, HTML, ODT, OTT, OXPS, PDF, RTF, TXT, XPS, CSV, etc.) for viewing;
  • Preview documents on public pages;
  • Co-author documents in real time with two co-editing modes (real-time and paragraph-locking).

All your office files stored in the Drupal Media module can be opened with ONLYOFFICE Docs for editing. You just need to call the drop-down list in the last table column and select the Edit in ONLYOFFICE action. The corresponding editor will open in the same tab. Those users who have Administrator rights can co-edit files in real time using the ONLYOFFICE editors.

When you create a post, you can add a new ONLYOFFICE element. The whole process is quite simple but requires some actions:

  1. Access Structure -> Content types -> Manage fields. Then click the Add field button to add a new field, File or Media. Don’t forget to set the label and save the changes.
  2. Specify the file formats. Again go to Structure -> Content types -> Manage fields. Specify the file formats that will be shown in the Allowed file extensions field. You can choose among DOCX, XLSX and PPTX. This works for File fields.

If you added a Media field, you need to click the Document checkbox.

  1. Then go to Structure -> Media types -> Document -> Manage display. If you added a Document field, specify the ONLYOFFICE Preview format. Here you can specify the dimensions of the embedded editor window.

These are some basic pre-settings that you need to adjust. After that, you can create posts on the Content tab. For this purpose, click the Add Content button and select the required content:

  • Enter the title and choose a file (if you deal with File fields).
  • For the Media section, you need to specify the name of the previously uploaded file.

The visitors of your website will be able to view the created page (People -> Permissions -> View published content).