Download the PHP package visuellverstehen/statamic-content-renderer without Composer
On this page you can find all versions of the php package visuellverstehen/statamic-content-renderer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download visuellverstehen/statamic-content-renderer
More information about visuellverstehen/statamic-content-renderer
Files in visuellverstehen/statamic-content-renderer
Package statamic-content-renderer
Short Description A Statamic search transformer for bard and replicator fields.
License MIT
Informations about the package statamic-content-renderer
Content Renderer
A Statamic addon that renders content from bard and replicator fields to make their content searchable with search transformers.
How to Install
Run the following command from your project root:
How to Use
The content renderer is available through the Renderer()
class. To render the content of a replicator or bard field, the class requires a view that provides the info of how to display all the configured sets, e. g.:
This view needs to be passed on to the renderer class.
The renderer uses the view to render all sets (and all written content of bard fields), sanitizes the content (strips all HTML tags etc.) and returns a string containing every written word from within the field.
This can be used within a search transformer to make the content of bard and replicator fields available for full-text search:
Preserving links targets
When using the Content Renderer within a search transformer, it might be useful to preserve link targets in the rendered output. This makes it possible to find entries based on urls linked in the content. You can instruct the renderer to add link targets in parenthesis behind the link text:
Preserving HTML tags
If you want to keep the HTML tags and/or modify the content in your own way, you can instruct the renderer not to strip them:
Note: If you choose to preserve HTML tags, the withLinkTargets
option (see above) will be ignored.
Custom processor
If you need to modify the content before it is passed on to the render process, you can optionally add a custom processor function:
This allows you to e. g. remove certain sets or modify the content in any other way.
More about us
License
The MIT license (MIT). Please take a look at the license file for more information.