2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-hail

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

image

firebrandhq/silverstripe-hail

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  • Monday, July 30, 2018
  • by firebrandhq
  • Repository
  • 3 Watchers
  • 1 Stars
  • 478 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 45 Versions
  • 32 % Grown

The README.md

Hail.to, (*1)

Hail.to Integration for SilverStripe 4

Silverstripe 4 module to integrate with Hail (https://get.hail.to), (*2)

If you need this module for SilverStripe 3 please refer to this branch., (*3)

:exclamation: If you are getting errors while fetching, please update to 4.2 version, (*4)

Features

  • Display Hail content inside your SilverStripe website
  • Ready to use with Bootstrap 4.1 styles and templates
  • Video and Image header for articles and publications
  • Hail Page
  • TinyMCE plugin
  • Configurable
  • Simplified code base
  • Emojis support as an option
  • SEO friendly
  • OpenGraph integration, see OpenGraph Support section
  • Silverstripe Elemental integration, see SilverStripe Elemental Support section
  • And more...

Requirements

For SilverStripe 4.1 to 4.3 use version 4.2.1, (*5)

Upgrade from older versions

This module has been re written for SilverStripe 4 and includes breaking changes compared to previous version. Please perform a fresh install if you are upgrading from previous versions by removing and re installing the module., (*6)

Installation

Run the following command:, (*7)

composer require firebrandhq/silverstripe-hail "^4"

(Optional) Enable Emojis Support (has to be done before doing the dev/build):, (*8)

See Emojis Support configuration, (*9)

Install Silverstripe Sake:, (*10)

cd your-webroot/
sudo ./vendor/bin/sake installsake

Please ensure sake is using php ^7.1, (*11)

Perform a dev/build, (*12)

Add the following lines (adapt them to your environment) to your crontab:, (*13)

You need to add those jobs to the cronjob of the user running your webserver (example on Ubuntu with apache2: sudo crontab -e -u www-data), (*14)

* * * * * cd /your-webroot/ && /usr/local/bin/sake dev/tasks/hail-fetch-queue
*/5 * * * * cd /your-webroot/ && /usr/local/bin/sake dev/tasks/hail-check-status
0 * * * * cd /your-webroot/ && /usr/local/bin/sake dev/tasks/hail-fetch-recurring

You can adapt the frequency of the hail-fetch-recurring job to your needs, it will always fetch up until previous fetch, (*15)

Authorize Silverstripe to fetch from Hail:

  1. Go to hail.to and signin, then go to your Developer Settings (https://hail.to/app/user/applications) and create a new application (Add new button)
  2. Add the generated Hail Client ID and Client Secret to your .env file:, (*16)

    HAIL_CLIENT_ID=[CLIENTID]
    HAIL_CLIENT_SECRET=[CLIENTSECRET]
    
  3. Go to SilverStripe admin settings page (/admin/settings/), then on the Hail tab
  4. Copy the Callback URL
  5. Back to the Hail Developer Settings, Click "Add new" in the redirect URI section and paste the Callback URL
  6. You are now ready to authorize your Hail application, go back to the SilverStripe Admin settings and click the "Authorise SilverStripe to Access Hail" button.
  7. After the authorization process is complete, you will be able to select the Hail Organisation(s) you want to fetch content from in the Admin Settings of SilverStripe.
  8. (Optional) You can globally exclude content with specific Public or Private tags in the Admin Settings of SilverStripe
  9. Save your Admin Settings

You can now either wait for your cron job to fetch the content or force a full fetch from the Hail menu in SilverStripe CMS using the Fetch button (top left in the page)., (*17)

jQuery and Bootstrap requirements

We include jQuery 3.3.1 and Bootstrap 4.1 (javascript and css) in our Hail Page and Hail Articles by default., (*18)

If you need to include your own jQuery and/or Bootstrap (If you compiled Bootstrap from source or want to include those globally for example), simply block our requirement(s) by adding one or all the following to your PageController init() function:, (*19)

protected function init()
{
    parent::init();
    // You can include any CSS or JS required by your project here.
    // See: https://docs.silverstripe.org/en/developer_guides/templates/requirements/

    \SilverStripe\View\Requirements::block('firebrandhq/silverstripe-hail: thirdparty/bootstrap/styles/bootstrap.min.css');
    \SilverStripe\View\Requirements::block('firebrandhq/silverstripe-hail: thirdparty/jquery/js/jquery.min.js');
    \SilverStripe\View\Requirements::block('firebrandhq/silverstripe-hail: thirdparty/bootstrap/js/bootstrap.bundle.min.js');
}

Configuration

The following yml configuration options are available for override:, (*20)

Hail API Client configuration: - BaseApiUrl: Base URL of the Hail API - AuthorizationUrl: Full URL of the Hail authorization - RefreshRate: Time after which a Hail Object is considered outdated - EnableEmojiSupport: See Emojis Support configuration - OnlyFetchPublishedObjects: By default the Hail module only fetches published objects, you can change this behavior by setting this value to false, (*21)

Default configuration:, (*22)

Firebrand\Hail\Api\Client:
  BaseApiUrl: 'https://hail.to/api/v1/'
  AuthorizationUrl: 'https://hail.to/oauth/authorise'
  RefreshRate: 86400
  EnableEmojiSupport: false
  OnlyFetchPublishedObjects: true

Hail Page Controller configuration: - UseDefaultCss: true / false Enables the default styles on Hail Pages and articles (Using Bootstrap 4.1), (*23)

Default configuration:, (*24)

Firebrand\Hail\Pages\HailPageController:
  UseDefaultCss: true

Hail Recurring Fetch Task configuration: - Emails: Fetching errors will be sent to the following email list (comma separated), put to false if you want to disable the emails, (*25)

Default configuration:, (*26)

Firebrand\Hail\Tasks\FetchRecurringTask:
  Emails: ''

In order to override those values you need to add a new yml file into your mysite/_config/ folder, specifying that your configuration needs to be included after Hail's., (*27)

Example yml config file:, (*28)


--- Name: 'myhailconfig' After: - '#hail-config' --- Firebrand\Hail\Api\Client: EnableEmojiSupport: true Firebrand\Hail\Tasks\FetchRecurringTask: Emails: 'developers@mycompany.com' ---

Usage

Once everything is configured and your Hail content is fetched you can create a Hail Page in the SilverStripe CMS to display the content on your website. The configuration of the Hail Page should be self explanatory, see screenshots below:, (*29)

Hail Page configuration:, (*30)

Hail Page config, (*31)

Once configured and published your Hail Page should look like this (using default styles and templates):, (*32)

Hail Page, (*33)

Emojis Support

IMPORTANT: Enabling Emojis Support will change the charset and collation of your SilverStripe database to utf8mb4 and utf8mb4_general_ci respectively., (*34)

utf8mb4 is backward compatible with utf8 so it should work with any existing or new database, we still chose to disable the feature to avoid imposing this change., (*35)

To enable Emojis support please add the following to your SilverStripe yml (following the example below) config and perform a dev/build., (*36)

Example yml config file:, (*37)


--- Name: 'myhailconfig' After: - '#hail-config' --- Firebrand\Hail\Api\Client: EnableEmojiSupport: true ---

OpenGraph Support

Open Graph support is now directly included in this module, provided you use Tractorcow's module for OG, (*38)

If you wish to modify our OG implementation for Hail pages / articles, you can use SilverStripe injection to do so., (*39)

SilverStripe Elemental Support

We offer a pre built SilverStripe Elemental block (Hail Carousel) for you to use:, (*40)

See Hail Elemental module for installation instructions, (*41)

Contributing

See CONTRIBUTING.md, (*42)

Versioning

This library follows Semver. According to Semver, you will be able to upgrade to any minor or patch version of this library without any breaking changes to the public API. Semver also requires that we clearly define the public API for this library., (*43)

All methods, with public visibility, are part of the public API. All other methods are not part of the public API. Where possible, we'll try to keep protected methods backwards-compatible in minor/patch versions, but if you're overriding methods then please test your work before upgrading., (*44)

Reporting Issues

Please create an issue for any bugs you've found, or features you're missing., (*45)

The Versions

30/07 2018

dev-master

9999999-dev

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

MIT BSD-3-Clause

The Requires

 

content silverstripe news hail

30/07 2018

4.0.15

4.0.15.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

30/07 2018

4.0.14

4.0.14.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

29/06 2018

4.0.13

4.0.13.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

28/06 2018

4.0.12

4.0.12.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

08/06 2018

4.0.11

4.0.11.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

07/06 2018

4.0.10

4.0.10.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

30/05 2018

4.0.9

4.0.9.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

29/05 2018

4.0.8

4.0.8.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

29/05 2018

4.0.7

4.0.7.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

24/05 2018

4.0.6

4.0.6.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

18/05 2018

4.0.5

4.0.5.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

18/05 2018

4.0.4

4.0.4.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

18/05 2018

4.0.3

4.0.3.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

18/05 2018

4.0.2

4.0.2.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

18/05 2018

4.0.1

4.0.1.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail

17/05 2018

4.0.0

4.0.0.0

Silverstripe 4 plugin to integrate with Hail (https://get.hail.to)

  Sources   Download

BSD-3-Clause

The Requires

 

content silverstripe news hail