https://github.com/bloke/smd_img_alt
Faster image alt boilerplate templating
https://github.com/bloke/smd_img_alt
Last synced: 3 months ago
JSON representation
Faster image alt boilerplate templating
- Host: GitHub
- URL: https://github.com/bloke/smd_img_alt
- Owner: Bloke
- License: lgpl-2.1
- Created: 2025-03-09T16:14:16.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-09T16:36:42.000Z (3 months ago)
- Last Synced: 2025-03-09T17:22:50.874Z (3 months ago)
- Language: PHP
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.textile
- Changelog: CHANGELOG.textile
- License: LICENSE
Awesome Lists containing this project
README
h1. smd_img_alt
Adds a dropdown of potted alt tags for rapid selection of alternate text. The alt tags are defined in a form and can have replacements applied to them from the article that the image is used in.
h2. Usage
After installation, create a form (of any type) called @smd_img_alt@. In this form, write your boilerplate alt text strings, one per line.
When you visit the Image Edit panel, the dropdown appears below the alt text box. Choosing an entry from the select list will immediately replace the contents in the alt text box with the selected entry for you to amend if you wish, before saving. Note the changes are not committed to the database until you Save them.
h2. Replacement strings
If you assign an image to an article, you can also use replacement variables in the alt text. The replacements are surrounded by curly braces, and take the names of article fields in the database. For example, if you had a serial number in custom field number 1 and product code in custom field 2, you could add a row to your form like this:
bc. Product: {custom_2} close-up (Serial number {custom_1})
Bear in mind:
# The replacements are made immediately, as the panel loads, so if there is a lot of text in your replacement strings, it can make the dropdown entries very long!
# If the image is associated with more than one article, only the first one will be used to grab replacements.