PluginProbe ʕ •ᴥ•ʔ
AlphaListing / 4.3.6
AlphaListing v4.3.6
4.5.0 trunk 4.3.4 4.3.5 4.3.6 4.3.7 4.4.0
alphalisting / src / Shortcode / QueryParts / SymbolsFirst.php
alphalisting / src / Shortcode / QueryParts Last commit date
Alphabet.php 11 months ago ColumnGap.php 11 months ago ColumnWidth.php 11 months ago Columns.php 11 months ago ExcludePosts.php 11 months ago ExcludeTerms.php 11 months ago HideEmptyTerms.php 11 months ago HideEmpty_Deprecated.php 11 months ago InstanceId.php 11 months ago ParentPost.php 11 months ago ParentTermCommon.php 11 months ago ParentTermId.php 11 months ago ParentTermSlugOrId.php 11 months ago PostType.php 11 months ago PostsTerms.php 11 months ago SymbolsFirst.php 11 months ago Taxonomy.php 11 months ago TermsCommon.php 11 months ago TermsTerms.php 11 months ago
SymbolsFirst.php
49 lines
1 <?php
2 /**
3 * Symbols First Query Part.
4 *
5 * @package alphalisting
6 */
7
8 declare(strict_types=1);
9
10 namespace eslin87\AlphaListing\Shortcode\QueryParts;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16 use \eslin87\AlphaListing\Shortcode\Extension;
17
18 /**
19 * Symbols First Query Part extension
20 */
21 class SymbolsFirst extends Extension {
22 /**
23 * The attribute for this Query Part.
24 *
25 * @since 4.0.0
26 * @var string
27 */
28 public $attribute_name = 'symbols-first';
29
30 /**
31 * Update the query with this extension's additional configuration.
32 *
33 * @param \AlphaListing\Query $query The query.
34 * @param string $display The display/query type.
35 * @param string $key The name of the attribute.
36 * @param mixed $value The shortcode attribute value.
37 * @param array $attributes The complete set of shortcode attributes.
38 * @return mixed The updated query.
39 */
40 public function shortcode_query( $query, string $display, string $key, $value, array $attributes ) {
41 if ( alphalisting_is_truthy( $value ) ) {
42 $this->add_hook( 'filter', 'alphalisting_unknown_letter_is_first', '__return_true', 10, 1 );
43 } else {
44 $this->add_hook( 'filter', 'alphalisting_unknown_letter_is_first', '__return_false', 10, 1 );
45 }
46 return $query;
47 }
48 }
49