PHPackages                             yaroslawww/nova-flexible-content-field-shortcode - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. yaroslawww/nova-flexible-content-field-shortcode

Abandoned → [think.studio/nova-flexible-content-field-shortcode](/?search=think.studio%2Fnova-flexible-content-field-shortcode)Library

yaroslawww/nova-flexible-content-field-shortcode
================================================

Designed specifically for the ability to add shortcodes to existing content.

3.0.1(2y ago)063MITPHPPHP ^8.1

Since Apr 22Pushed 2y ago1 watchersCompare

[ Source](https://github.com/dev-think-one/nova-flexible-content-field-shortcode)[ Packagist](https://packagist.org/packages/yaroslawww/nova-flexible-content-field-shortcode)[ Docs](https://github.com/yaroslawww/nova-flexible-content-field-shortcode)[ RSS](/packages/yaroslawww-nova-flexible-content-field-shortcode/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (8)Versions (7)Used By (0)

Laravel nova shortcode based on "nova-flexible-content"
=======================================================

[](#laravel-nova-shortcode-based-on-nova-flexible-content)

[![Packagist License](https://camo.githubusercontent.com/9501796d30731a6283fa1566100ffd06878a21398c1ad8e81d9232a7471fb524/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7468696e6b2e73747564696f2f6e6f76612d666c657869626c652d636f6e74656e742d6669656c642d73686f7274636f64653f636f6c6f723d253233346463373166)](https://camo.githubusercontent.com/9501796d30731a6283fa1566100ffd06878a21398c1ad8e81d9232a7471fb524/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7468696e6b2e73747564696f2f6e6f76612d666c657869626c652d636f6e74656e742d6669656c642d73686f7274636f64653f636f6c6f723d253233346463373166)[![Packagist Version](https://camo.githubusercontent.com/5046496d788714d2fa136e0435acce8cc3910b28228e3f02ec2ab60b598328a0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468696e6b2e73747564696f2f6e6f76612d666c657869626c652d636f6e74656e742d6669656c642d73686f7274636f6465)](https://packagist.org/packages/think.studio/nova-flexible-content-field-shortcode)[![Total Downloads](https://camo.githubusercontent.com/58f062dfeac835c17d00f706394f74a1e01c074b0d5e3b87d4c89849498e315c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7468696e6b2e73747564696f2f6e6f76612d666c657869626c652d636f6e74656e742d6669656c642d73686f7274636f6465)](https://packagist.org/packages/think.studio/nova-flexible-content-field-shortcode)[![Build Status](https://camo.githubusercontent.com/38a45d64a88388007c57a37ea403ae481341362c879cc1f4dcd558a8bec6e7ca/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465762d7468696e6b2d6f6e652f6e6f76612d666c657869626c652d636f6e74656e742d6669656c642d73686f7274636f64652f6261646765732f6275696c642e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/dev-think-one/nova-flexible-content-field-shortcode/build-status/main)[![Code Coverage](https://camo.githubusercontent.com/00610d8dfde2a81fd0618d7fd7d500fbc6a6a9369b3719ef8ec0387f94faa636/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465762d7468696e6b2d6f6e652f6e6f76612d666c657869626c652d636f6e74656e742d6669656c642d73686f7274636f64652f6261646765732f636f7665726167652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/dev-think-one/nova-flexible-content-field-shortcode/?branch=main)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9167380d6c0001fa86c9d093cfd24b5b93b2659580f220047ff8c4cf1f2f0810/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465762d7468696e6b2d6f6e652f6e6f76612d666c657869626c652d636f6e74656e742d6669656c642d73686f7274636f64652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/dev-think-one/nova-flexible-content-field-shortcode/?branch=main)

A very highly targeted package. Designed specifically for the ability to add shortcodes to existing content. If you are just starting to develop an application then just use `think.studio/nova-flexible-content` or alternative without using this package. The package is needed if you already have a large amount of content, and the client requires adding new functionality

NovaPackageV1V1 V2V4V3Installation
------------

[](#installation)

You can install the package via composer:

1. Install "flexible content" package.

```
composer require think.studio/nova-flexible-content
```

2. Install "shortcode" package

```
composer require think.studio/nova-flexible-content-field-shortcode
# optional publish configs
php artisan vendor:publish --provider="ThinkOne\NovaFlexibleContentFieldShortcode\ServiceProvider" --tag="config"
```

Usage
-----

[](#usage)

### Admin

[](#admin)

`\ThinkOne\NovaFlexibleContentFieldShortcode\ShortcodeText` field. You need add it to **top level** layouts in you flexible content

```
class ImageLayout extends \NovaFlexibleContent\Layouts\Layout
{
    public function fields(): array
    {
        return [
            \ThinkOne\NovaFlexibleContentFieldShortcode\ShortcodeText::make('Shortcode')
            ->help('All parameters you can find here'),
            NLFMImage::make('Image', 'image'),
            Text::make('Caption', 'caption'),
        ];
    }
}

class ImageLayout extends \NovaFlexibleContent\Layouts\Layout
{
    public function fields(): array
    {
        return [
           \ThinkOne\NovaFlexibleContentFieldShortcode\ShortcodeText::make('Shortcode'),
            NLFMImage::make('Image', 'image'),
            Text::make('Caption', 'caption'),
        ];
    }
}

class ImagesSliderLayout extends \NovaFlexibleContent\Layouts\Layout
{
    public function fields(): array
    {
        return [
            \ThinkOne\NovaFlexibleContentFieldShortcode\ShortcodeText::make('Shortcode'),
            \NovaFlexibleContent\Flexible::make('Slider', 'slider')
                    ->useLayout(ImageSlideLayout::class)
                    ->layoutsMenuButton('Add slide'),
        ];
    }
}

\NovaFlexibleContent\Flexible::make('Shortcodes', 'shortcodes')
    ->useLayout(ImageLayout::class)
    ->useLayout(ImagesSliderLayout::class)
    ->layoutsMenuButton('Add shortcode')
    ->hideWhenCreating(),
```

[![](doc/assets/shortcode_example.gif)](doc/assets/shortcode_example.gif)

### Html presenter

[](#html-presenter)

You need create "presenters" to display your shortcodes. Any presenter should implement interface `ThinkOne\NovaFlexibleContentFieldShortcode\ShortcodePresenter`
Example:

```
use ThinkOne\NovaFlexibleContentFieldShortcode\ViewPresenter;

class ImageWithCaption extends ViewPresenter
{
    protected string $viewPath = 'my-folder.shortcodes.image-with-caption';
}
```

```
# my-folder/shortcodes/image-with-caption.blade.php
@if(!empty($shortcodeData) && !empty($shortcodeData['image']))

            @if(!empty($shortcodeData['caption']))

                    {{$shortcodeData['caption']}}

            @endif

@endif
```

### Render example with trait

[](#render-example-with-trait)

```
class Article extends Model {

    use \ThinkOne\NovaFlexibleContentFieldShortcode\Eloquent\HasShortcodes;

    public function shortcodesMap(): array {
        return [ 'image' => ImageWithCaption::class, ];
    }

    public function getFullContentAttribute(): string {
        return $this->getDataWithShortcodes( WysiwygHelper::filter( (string) $this->content ) );
    }

    public function getFullContentOtherAttribute(): string {
        return $this->getDataWithShortcodes( WysiwygHelper::filter( (string) $this->content_other ) );
    }
}
```

Then call it:

```
{!! $article->full_content !!}
{!! $article->full_content_other !!}
```

### Raw render example

[](#raw-render-example)

```
class Post extends Model
{
    public function presentersMap(): array
    {
        return [
            'image'  => ImageWithCaption::class,
            'EYsCY62xKnkHrvIo'  => AdHocImageWithCaption::class,
            'slider' => ImagesSlider::class,
        ];
    }

    public function shortcodesData(): array
    {
        $data = null;
        if ($this->shortcodes && is_string($this->shortcodes)) {
            $data = json_decode($this->shortcodes, true);
        }

        return is_array($data) ? $data : [];
    }

    public function postContent(): ?string
    {
        return \ThinkOne\NovaFlexibleContentFieldShortcode\ShortcodeCompiler::make(
            $this->shortcodesData(), // array represent "nova-flexible-content" field
            $this->presentersMap() // array represent presenters map (key => class), see above
        )->renderShortcodes(
          $this->content // text containing shortcode, maybe you need to filter it to prevent xss
        );
    }
}
```

Credits
-------

[](#credits)

- [![Think Studio](https://camo.githubusercontent.com/8e541bece07d503c85a126b5294865faa00e27371048772f566a0cce8c01fd3a/68747470733a2f2f7961726f736c617777772e6769746875622e696f2f696d616765732f73706f6e736f72732f7061636b616765732f6c6f676f2d7468696e6b2d73747564696f2e706e67)](https://think.studio/)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~210 days

Total

5

Last Release

1004d ago

Major Versions

1.0.0 → 2.0.02021-10-13

2.0.1 → 3.0.02022-07-07

PHP version history (3 changes)1.0.0PHP &gt;=7.4

2.0.0PHP ^8.0

3.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23663794?v=4)[yaroslawww](/maintainers/yaroslawww)[@yaroslawww](https://github.com/yaroslawww)

---

Top Contributors

[![yaroslawww](https://avatars.githubusercontent.com/u/23663794?v=4)](https://github.com/yaroslawww "yaroslawww (11 commits)")

---

Tags

shortcodenovalaravel-novanova-flexible-content

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/yaroslawww-nova-flexible-content-field-shortcode/health.svg)

```
[![Health](https://phpackages.com/badges/yaroslawww-nova-flexible-content-field-shortcode/health.svg)](https://phpackages.com/packages/yaroslawww-nova-flexible-content-field-shortcode)
```

###  Alternatives

[maatwebsite/laravel-nova-excel

Supercharged Excel exports for Laravel Nova Resources

3986.2M5](/packages/maatwebsite-laravel-nova-excel)[laravel/nova-log-viewer

A Laravel Nova tool for viewing your application logs.

136301.3k1](/packages/laravel-nova-log-viewer)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)[dniccum/nova-documentation

A Laravel Nova tool that allows you to add markdown-based documentation to your administrator's dashboard.

37116.4k](/packages/dniccum-nova-documentation)[optimistdigital/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45305.4k](/packages/optimistdigital-nova-multiselect-filter)[laravel/nova-pennant

A Pennant Resource Tool for Laravel Nova

23135.5k](/packages/laravel-nova-pennant)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
