Alphabet.php
9 months ago
ColumnGap.php
9 months ago
ColumnWidth.php
9 months ago
Columns.php
9 months ago
ExcludePosts.php
9 months ago
ExcludeTerms.php
9 months ago
HideEmptyTerms.php
9 months ago
HideEmpty_Deprecated.php
9 months ago
InstanceId.php
9 months ago
ParentPost.php
9 months ago
ParentTermCommon.php
9 months ago
ParentTermId.php
9 months ago
ParentTermSlugOrId.php
9 months ago
PostType.php
9 months ago
PostsTerms.php
9 months ago
SymbolsFirst.php
9 months ago
Taxonomy.php
9 months ago
TermsCommon.php
9 months ago
TermsTerms.php
9 months ago
ColumnGap.php
65 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Alphabet 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 | * Column Gap Query Part extension |
| 20 | */ |
| 21 | class ColumnGap extends Extension { |
| 22 | /** |
| 23 | * The attribute for this Query Part. |
| 24 | * |
| 25 | * @since 4.0.0 |
| 26 | * @var string |
| 27 | */ |
| 28 | public $attribute_name = 'column-gap'; |
| 29 | |
| 30 | /** |
| 31 | * The column gap. |
| 32 | * |
| 33 | * @var string |
| 34 | */ |
| 35 | public $column_gap = '0.6em'; |
| 36 | |
| 37 | /** |
| 38 | * Update the query with this extension's additional configuration. |
| 39 | * |
| 40 | * @param \AlphaListing\Query $query The query. |
| 41 | * @param string $display The display/query type. |
| 42 | * @param string $key The name of the attribute. |
| 43 | * @param mixed $value The shortcode attribute value. |
| 44 | * @param array $attributes The complete set of shortcode attributes. |
| 45 | * @return mixed The updated query. |
| 46 | */ |
| 47 | public function shortcode_query( $query, string $display, string $key, $value, array $attributes ) { |
| 48 | $this->column_gap = $value; |
| 49 | $this->add_hook( 'filter', 'alphalisting_styles', array( $this, 'return_styles' ), 10, 3 ); |
| 50 | return $query; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Return the stylesheet for this instance. |
| 55 | * |
| 56 | * @param string $styles The stylesheet. |
| 57 | * @param \AlphaListing\Query $alphalisting The A-Z Listing Query object. |
| 58 | * @param string $instance_id The instance ID. |
| 59 | * @return string |
| 60 | */ |
| 61 | public function return_styles( $styles, $alphalisting, $instance_id ): string { |
| 62 | return "$styles --alphalisting-column-gap: $this->column_gap; "; |
| 63 | } |
| 64 | } |
| 65 |