Download the PHP package goldnead/statamic-bard-footnotes without Composer

On this page you can find all versions of the php package goldnead/statamic-bard-footnotes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package statamic-bard-footnotes

Bard Footnotes

Footnotes for Statamic's Bard field: a toolbar button, inline superscript references, and an automatic source list. No second field, no typed [1] markers — the footnote lives in the text itself, as a node.

Requires Statamic 6. On Statamic 5, use the 1.x branch (see UPGRADE.md).

Installation

The publish step copies the compiled control panel bundle into public/vendor/statamic-bard-footnotes. No Node toolchain is needed — dist/ ships with the package.

The button

The button appears in a Bard field when its blueprint config lists it, like every core button:

Footnotes stay readable (and editable) in fields whose config does not list the button — only the toolbar button is opt-in, the node itself always renders.

In the CP

Place the cursor where the reference belongs and click Footnote. Fill in the source and, optionally, a link; Apply inserts the footnote at the cursor. With text selected, the footnote is inserted at the end of the selection and the selected text stays as it is (it is not used as the source). The popover's select at the top offers the sources already cited in this field — picking one fills the fields with its text and link. The editor shows the live superscript number; hovering it reveals the source.

Clicking a footnote reopens the popover. Editing the source it already cites changes every place citing it (the popover says "Used N times"). Picking a different source, or "New source", re-points only this one footnote. A footnote with neither text nor link has no source: it gets no number, no list entry and renders nothing.

Sources under the field

As soon as a field cites a source, a compact list Sources (N) appears under the editor, inside the field. It is where the sources of the text are kept in order:

The list updates with every change in the editor and disappears when the last footnote goes. It shows in every Bard field that holds footnotes, with or without the toolbar button. A read-only field lists its sources without Edit. Footnotes are removed in the text, where they stand (click the footnote, Remove Footnote) — there is no "remove" in the list, so nothing leaves the text without the sentence around it in view.

Numbers are never stored. They are derived from the document: order of first occurrence, with the same source keeping the same number. "Same source" means the same link (trimmed), or — without a link — the same text (whitespace trimmed and collapsed, Unicode spaces such as NBSP included, case-insensitive). PHP and the editor apply exactly the same rule.

In Antlers

Render the article, then the source list:

The single tag renders the shipped bard-footnotes::list view: a "Sources" heading, an ordered list, external links with target="_blank" rel="noopener noreferrer", and a ↩ back link per source. Text and url are always escaped. No footnotes, no output.

Bard with sets numbers across the whole field — a footnote before a set and one after it are numbered in reading order. (A Bard field nested inside a set is its own document and numbers separately, the same way Statamic augments it.)

Tag pair — loop the sources yourself:

The tag reads the field's raw value from the template context, by handle — a :content="content" binding would arrive as already-rendered HTML, too late to read the footnotes from. field is therefore the handle of a Bard variable available where the tag is used (an entry's content, a loop variable, …). If it is missing or not a Bard value, the tag renders nothing; with APP_DEBUG=true it also writes one warning to the log naming the field. Each source carries number, text, url (null unless http(s)). no_results and total_results behave like in Statamic's collection tags.

Publish the view to make it your own:

In PHP

For Blade, Inertia or anywhere outside Antlers:

sources() accepts the raw field value, a Statamic Value or a collection. The rendered HTML needs nothing from you — the augment hook numbers every footnote of the field and the node turns each into the superscript link.

Rendering a Bard field in parts

The augment hook numbers whatever document it is given. If your app renders one Bard field in parts — say one Augmentor::convertToHtml() call per stretch of text between two sets — the hook runs once per part and every part would start again at 1. Number the whole document first, then split it:

Footnotes::number() is idempotent: a document in which every footnote with a source already carries a number is returned unchanged, so the hook keeps the field-wide numbers in each part, and id="fnref-n" stays on the first occurrence in the whole field. A partly numbered document is numbered anew.

CSS

No frontend assets are published; two small rules cover the essentials:

Limits

License

MIT — see LICENSE.


All versions of statamic-bard-footnotes with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
statamic/cms Version ^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package goldnead/statamic-bard-footnotes contains the following files

Loading the files please wait ...