| | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Outputs the search bar (likely don't need anymore) |
| | | * @param string $placeholder |
| | | * @param string $id |
| | | * @param string $label |
| | | * @param string $buttonText |
| | | * @param bool $buttonInside |
| | | * @param bool $hideSearch |
| | | * @return string |
| | | */ |
| | | function jvbSearch(string $placeholder = 'Search...', string $id = 'search', string $label = '', string $buttonText = '', bool $buttonInside = false, bool $hideSearch = false):string |
| | |
| | | |
| | | |
| | | |
| | | function jvbModalActions() |
| | | function jvbModalActions():string |
| | | { |
| | | return '<div class="m-actions row"> |
| | | <button type="button" class="cancel">'.jvbIcon('x').'<span class="screen-reader-text">Cancel</span></button> |
| | | <button type="submit" class="save">'.jvbIcon('floppy-disk').'<span class="screen-reader-text">Save</span></button> |
| | | </div>'; |
| | | return sprintf( |
| | | '<div class="m-actions row"> |
| | | <button type="button" class="cancel">%s<span class="screen-reader-text">Cancel</span></button> |
| | | <button type="submit" class="save">%s<span class="screen-reader-text">Save</span></button> |
| | | </div>', |
| | | jvbIcon('x'), |
| | | jvbIcon('floppy-disk') |
| | | ); |
| | | } |
| | | |
| | | function jvbNewModal(string $class, string $title, string $form) |
| | | function jvbNewModal(string $class, string $id, string $title, string $form):string |
| | | { |
| | | return '<dialog class="'.$class.'"> |
| | | return sprintf( |
| | | '<dialog class="%s" id="%s"> |
| | | <div class="wrap"> |
| | | <h2>'.$title.'</h2> |
| | | '.str_replace('</form>', jvbModalActions().'</form>', $form).' |
| | | <h2>%s</h2> |
| | | %s |
| | | </div> |
| | | </dialog>'; |
| | | </dialog>', |
| | | $class, |
| | | sanitize_title($id), |
| | | $title, |
| | | str_replace('</form>', jvbModalActions().'</form>', $form) |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * Formats an image to match our image replacement formatting |
| | | * @param int|string $imgID |
| | | * Formats an image to match our image replacement formatting |
| | | * @param int $imgID |
| | | * @param string $start |
| | | * @param string $end |
| | | * |
| | | * @param bool $addLink |
| | | * @param string|null $postSlug |
| | | * @return string |
| | | */ |
| | | function jvbFormatImage(int $imgID, string $start = 'tiny', string $end = 'large', bool $addLink = true, ?string $postSlug = null):string |