PHP code example of jacksleight / statamic-focal-link
1. Go to this page and download the library: Download jacksleight/statamic-focal-link library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jacksleight / statamic-focal-link example snippets
'entry::products::*' => [ // All entries within the products collection
'discovery' => [
"//*[@id]" => "text()", // Elements with an ID attribute, with the text content as a label
],
'fragments' => [
"reviews" => "Reviews" // A fixed option
":~:text={{ text }}" => "Text Fragment", // A template option
],
'queries' => [
"size=large" => "Size — Large" // A fixed option
"size={{ medium }}" => "Size" // A template option
],
],
use JackSleight\StatamicBardMutator\Facades\Mutator;
Mutator::tag('heading', function ($tag, $data) {
$tag[0]['attrs']['id'] = str_slug(collect($data->content)->implode('text', ''));
return $tag;
});