This module allows connection to the OneHub API and has two widgets:

1. Field widget to upload files to OneHub.
2. Select widget to display all files within a selected OneHub folder.

Alpha21+ requires at least Drupal 8.7.0

File Widget

It is a file type widget, however no file is stored locally. All files used through the widget are stored on OneHub. There is a reference on the entity where the widget is to the file.

Setup

  1. You will need a developer OneHub account in addition to your regular OneHub account. The developer account is used for the API only.
  2. With your application setup in your developer account, go to admin/config/services/onehub/settings and enter the required fields.
  3. Click on the authorize tab and then hit the authorize button to establish an Oauth connection.
  4. On your entity, add a field, then select Reference -> OneHub File.

On entity edit, you will be able to upload a file, select the workspace and folder where it will go. On the entity view, you will see a button to download the file form OneHub.

Select Widget

See the setup for the File Widget above. The only difference is On your entity, add a field, then select Reference -> OneHub Select.

On entity edit, select your workspace and folder. When you view the entity, all the files for the folder will be displayed.

Views

The OneHub file table is also exposed to Views.

Cron / Updating

I strongly recommend using a module like Ultimate Cron to update the OneHub records. To save time, OneHub's info is stored in Drupal's DB. So, these records need to be updated regularly to make sure you are in sync.

When you set up your cron mechanisms, I wouldn't do it more frequent than 15 mins. It takes about 3-4 mins to update the site if you have thousands of OneHub files.

There is also a manual updater located at /admin/config/services/onehub/update that you can use to manually update the tables via a batch mechanism.

API

It also comes with a method to call the OneHub API endpoints as well. Almost all the calls are already built with the OneHubApi Class, but you can still utilize this to write your own logic if need be.

use Drupal\onehub\OneHubApi;

function whatever() {
  $oh = new OneHubApi();
  $params = []; // Any additional params you need to pass to the call. 
  $api = $oh->callAPI('endpoint', 'GET/POST/PUT/DELETE', $params);
}

You can also extend the class obviously for a more OO approach.

Supporting organizations: 

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • Module categories: Media, Integrations
  • Created by labboy0276 on , updated
  • shieldStable releases for this project are covered by the security advisory policy.
    There are currently no supported stable releases.

Releases