Add constant for chapter icon examples

This commit is contained in:
Tetrakern 2024-01-23 11:30:59 +01:00
parent 9ac9089205
commit 1612f6cd69
3 changed files with 19 additions and 8 deletions

View File

@ -1195,3 +1195,4 @@ define( 'CONSTANT_NAME', value );
| FICTIONEER_ENABLE_MENU_TRANSIENTS | boolean | Whether to cache nav menus as Transients. Default `true`.
| FICTIONEER_ORDER_STORIES_BY_LATEST_CHAPTER | boolean | Whether to order updated stories based on the latest chapter added, excluding stories without chapters. Default `false`.
| FICTIONEER_ENABLE_STORY_CHANGELOG | boolean | Whether changes to the story chapter list should be logged. Default `true`.
| FICTIONEER_EXAMPLE_CHAPTER_ICONS | array | Collection of example Font Awesome icon class strings.

View File

@ -381,6 +381,23 @@ if ( ! defined( 'FICTIONEER_ENABLE_BROWSER_NOTES' ) ) {
define( 'FICTIONEER_ENABLE_BROWSER_NOTES', true );
}
/*
* Arrays
*/
// Array: Example collection of Font Awesome icons
if ( ! defined( 'FICTIONEER_EXAMPLE_CHAPTER_ICONS' ) ) {
define(
'FICTIONEER_EXAMPLE_CHAPTER_ICONS',
['fa-solid fa-book', 'fa-solid fa-star', 'fa-solid fa-heart', 'fa-solid fa-bomb', 'fa-solid fa-wine-glass',
'fa-solid fa-face-smile', 'fa-solid fa-shield', 'fa-solid fa-ghost', 'fa-solid fa-gear', 'fa-solid fa-droplet',
'fa-solid fa-fire', 'fa-solid fa-radiation', 'fa-solid fa-lemon', 'fa-solid fa-globe', 'fa-solid fa-flask',
'fa-solid fa-snowflake', 'fa-solid fa-cookie-bite', 'fa-solid fa-circle', 'fa-solid fa-square', 'fa-solid fa-moon',
'fa-solid fa-brain', 'fa-solid fa-diamond', 'fa-solid fa-virus', 'fa-solid fa-horse-head', 'fa-solid fa-certificate',
'fa-solid fa-scroll', 'fa-solid fa-spa', 'fa-solid fa-skull']
);
}
// =============================================================================
// FAST REQUESTS
//

View File

@ -603,13 +603,6 @@ function fictioneer_get_metabox_icons( $post, $meta_key, $args = [] ) {
$data_required = $required ? 'data-required="true"' : '';
$current_icon_class = fictioneer_get_icon_field( $meta_key, $post->ID );
$icons = ['fa-solid fa-book', 'fa-solid fa-star', 'fa-solid fa-heart', 'fa-solid fa-bomb', 'fa-solid fa-wine-glass',
'fa-solid fa-face-smile', 'fa-solid fa-shield', 'fa-solid fa-ghost', 'fa-solid fa-gear', 'fa-solid fa-droplet',
'fa-solid fa-fire', 'fa-solid fa-radiation', 'fa-solid fa-lemon', 'fa-solid fa-globe', 'fa-solid fa-flask',
'fa-solid fa-snowflake', 'fa-solid fa-cookie', 'fa-solid fa-circle', 'fa-solid fa-square', 'fa-solid fa-moon',
'fa-solid fa-brain', 'fa-solid fa-diamond', 'fa-solid fa-virus', 'fa-solid fa-horse-head', 'fa-solid fa-certificate',
'fa-solid fa-scroll', 'fa-solid fa-spa', 'fa-solid fa-skull'];
ob_start();
// Start HTML ---> ?>
@ -632,7 +625,7 @@ function fictioneer_get_metabox_icons( $post, $meta_key, $args = [] ) {
<div class="fictioneer-meta-field__button-grid hidden">
<?php
foreach( $icons as $icon ) {
foreach( FICTIONEER_EXAMPLE_CHAPTER_ICONS as $icon ) {
echo "<button type='button' class='fictioneer-meta-field__icon-button' data-value='{$icon}'><i class='{$icon}'></i></button>";
}
?>