Extensions:Template Tags

From Lorekeeper Wiki
Jump to navigation Jump to search
Template Tags
Description Allows you to create reusable template tags that are parsed to html automatically when used in a description.
Author(s) Cylunny, Moif
Status testing
Github extension/template-tags
LK Version 2.1.2
Contains a Migration



Allows you to create reusable template tags that are parsed to html automatically when used in a description. This is built similar to item tags which means new tags can be created by other devs if they wish to! For now, the following templates are available:

  • pure (Pure HTML, put anything you want to easily re-use here)
  • dialogue (Turns your input into a little dialogue, visual novel style, with potential background/multiple characters beside each other)
  • world expansion card (turns any world expansion item into a preview card, or many, if the Extensions: World Expansion is also installed)


Installation

  • pull & deal with merge conflicts
  • php artisan migrate
  • php artisan optimize x2
  • php artisan update-extension-tracker

Configuration

Create tags via Admin panel (under Site), it should be pretty self explanatory! You must first select the tag type, then save and you will see the options depending on what you picked.

Usage

The tags like #pure1, #dialogue1 or #world_expansion_card1 will be put into a description and upon page load it renders as the actual thing!

Troubleshooting

We are never 100% safe from those pesky bugs. If you find something, feel free to contact me- I am cylunny on discord or toyhou.se!

World Expansion

Note that amazing world expansion extension does not use the Model we used for this extension by default. So if you want to use the tags within world expansion descriptions, simply edit the following line in Fauna.php, Flora.php etc. from: use Illuminate\Database\Eloquent\Model; to use App\Models\Model; and it should work!

Images

Creating New Template Tags

If you would like to add tags feel free to put a PR in but you might have to also poke my DMs x'D. Thanks moif for the following writeup!

If you've created an item tag before it's pretty much the same basic setup.

  1. Add the new tag to `config/lorekeeper/template_tags.php` - the key you use will need to be used in the naming of all the other files for it.
  2. (Optional?) Create a service file, there are examples provided at `app/Services/Templates/...`. Use this only if needed to eg. format the tag data.
  3. Create the admin settings blades: `resources/views/admin/templates/tags/yourtag.blade.php`.
  4. Create the user side blade: `resources/views/templates/yourtag.blade.php`

That should be it!

See Also

If this extension helped you, feel free to support me on Kofi! Or go support moif who helped me out~