All Projects → InteractionDesignFoundation → nova-unlayer-field

InteractionDesignFoundation / nova-unlayer-field

Licence: MIT license
🦜 Drag’n’drop email builder for Laravel Nova that uses Adds a Laravel Nova field for Unlayer service under the hood.

Programming Languages

Vue
7211 projects
PHP
23972 projects - #3 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to nova-unlayer-field

nova-url-field
A URL input and link field for Laravel Nova
Stars: ✭ 96 (+255.56%)
Mutual labels:  nova, laravel-nova-field
nova-json-wrapper
Allows you to group Nova fields and merge their output into a single JSON column
Stars: ✭ 14 (-48.15%)
Mutual labels:  nova, laravel-nova-field
nova-hidden-field
A Laravel Nova Hidden field.
Stars: ✭ 32 (+18.52%)
Mutual labels:  nova, laravel-nova-field
nova-inline-morph-to
A Laravel Nova field for displaying morphTo relationship inline.
Stars: ✭ 32 (+18.52%)
Mutual labels:  nova, laravel-nova-field
nova-phone-number
A Laravel Nova field to format and validate phone numbers.
Stars: ✭ 60 (+122.22%)
Mutual labels:  nova
Aos Avp
NOVA opeN sOurce Video plAyer: main repository to build them all
Stars: ✭ 229 (+748.15%)
Mutual labels:  nova
Nova Tags Field
A tags field to use in your Nova apps
Stars: ✭ 204 (+655.56%)
Mutual labels:  nova
Nova Filemanager
A Filemanager tool for Laravel Nova
Stars: ✭ 189 (+600%)
Mutual labels:  nova
nova-json-schema-field
Laravel Nova field for displaying JSON schema data
Stars: ✭ 27 (+0%)
Mutual labels:  nova
nova-permissions
Add Permissions based authorization for your Nova installation via User-based Roles and Permissions. Roles are defined in the database whereas Permissions are defined in the code base.
Stars: ✭ 115 (+325.93%)
Mutual labels:  nova
nova-money-field
Money Field for Laravel Nova
Stars: ✭ 71 (+162.96%)
Mutual labels:  nova
AsyncOpenStackClient
Asyncio wrapper to OpenStack API
Stars: ✭ 17 (-37.04%)
Mutual labels:  nova
nova-chartjs
A Chart JS component for Laravel Nova
Stars: ✭ 47 (+74.07%)
Mutual labels:  nova
Nova Colors
Single source of truth to consume Nova color values
Stars: ✭ 217 (+703.7%)
Mutual labels:  nova
nova-filepond
A Nova field for uploading File, Image and Video using Filepond.
Stars: ✭ 36 (+33.33%)
Mutual labels:  laravel-nova-field
Skeleton Nova Tool
A skeleton repository for Spatie's Nova Packages
Stars: ✭ 191 (+607.41%)
Mutual labels:  nova
nova-file-upload-field
The easiest drag-and-drop file uploading field for Laravel Nova.
Stars: ✭ 53 (+96.3%)
Mutual labels:  nova
nova-relationship-selector
Laravel Nova - Relationship Selector
Stars: ✭ 26 (-3.7%)
Mutual labels:  nova
nova-algolia-card
A Laravel Nova card for Algolia
Stars: ✭ 22 (-18.52%)
Mutual labels:  nova
checkout
Laravel Cart, Checkout, Orders and Coupons API with Nova Management
Stars: ✭ 36 (+33.33%)
Mutual labels:  nova

Nova Unlayer Field

Latest Stable Version Total Downloads License

image

Adds a Laravel Nova field for Unlayer to compose emails and landing pages.

image

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require interaction-design-foundation/nova-unlayer-field

⚠️ For PHP 7.1 - PHP 7.4 please use version 0.2.2 (it uses another namespace).

Optional: publish the configuration

Run this on the command line from the root of your project:

php artisan vendor:publish --provider="InteractionDesignFoundation\NovaUnlayerField\ServiceProvider" --tag=config

Usage

This package assumes that your Model has an attribute to store Unlayer design config JSON string (it’s better to use json or jsonb or longtext SQL type to store it).

On submit, the package automatically stores Unlayer design config only (JSON string). Most likely, you also want to do something with the output HTML code, generated by Unlayer. To access it, please use savingCallback() method (see an extended example below).

Basic field config:

use InteractionDesignFoundation\NovaUnlayerField\Unlayer;

public function fields()
{
    return [
        Unlayer::make('Content', 'design')->config([
            'projectId' => config('unlayer.project_id'),

            // optional
            'templateId' => config('unlayer.default_template_id'), // Used only if bound attribute ('design' in this case) is empty.
            'displayMode' => 'web', // "email" or "web". Default value: "email"
            'locale' => 'es', // Locale for Unlayer UI. Default value: application’s locale.
        ]),
     ];
}

Options

  • ->config(array|callable $config): Specify Unlayer config.
  • ->height(string $height): Set height of the editor (with units). E.g. '1000px' (800px by default).
  • ->savingCallback(?callable $callback): Specify a callback to call on before Model saving. Useful to store generated HTML code (to a Model or as a file).

Example of using savingCallback:

Unlayer::make('Design')->config([
        'projectId' => config('unlayer.project_id'),
    ])
    ->savingCallback(function (NovaRequest $request, $attribute, Newsletter $newsletterModel, $outputHtmlFieldName) {
        // set output HTML to your model (Newsletter in this case)
        // No need to call $model->save() — Nova will do it down the road.
        $newsletterModel->html = $request->input($outputHtmlFieldName);
    }),

Changelog

Please see Releases for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].