PluginProbe ʕ •ᴥ•ʔ
AlphaListing / 4.5.0
AlphaListing v4.5.0
4.5.0 trunk 4.3.4 4.3.5 4.3.6 4.3.7 4.4.0
alphalisting / src / Shortcode / QueryParts / ColumnWidth.php
alphalisting / src / Shortcode / QueryParts Last commit date
Alphabet.php 2 weeks ago BackToTop.php 2 weeks ago ColumnGap.php 2 weeks ago ColumnWidth.php 2 weeks ago Columns.php 2 weeks ago CssLengthCommon.php 2 weeks ago ExcludePosts.php 2 weeks ago ExcludeTerms.php 2 weeks ago GroupBy.php 2 weeks ago HideEmptyTerms.php 2 weeks ago HideEmpty_Deprecated.php 2 weeks ago InstanceId.php 2 weeks ago ParentPost.php 2 weeks ago ParentTermCommon.php 2 weeks ago ParentTermId.php 2 weeks ago ParentTermSlugOrId.php 2 weeks ago PostType.php 2 weeks ago PostsTerms.php 2 weeks ago SymbolsFirst.php 2 weeks ago Taxonomy.php 2 weeks ago TermsCommon.php 2 weeks ago TermsTerms.php 2 weeks ago
ColumnWidth.php
84 lines
1 <?php
2 /**
3 * Column Width 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 /**
17 * Column Width Query Part extension
18 */
19 class ColumnWidth extends CssLengthCommon {
20 /**
21 * The default column width.
22 *
23 * @since 4.3.2
24 * @var string
25 */
26 public const DEFAULT_COLUMN_WIDTH = '15em';
27
28 /**
29 * The attribute for this Query Part.
30 *
31 * @since 4.0.0
32 * @var string
33 */
34 public $attribute_name = 'column-width';
35
36 /**
37 * The column width.
38 *
39 * @var string
40 */
41 public $column_width = self::DEFAULT_COLUMN_WIDTH;
42
43 /**
44 * The default length to fall back on when sanitization rejects a value.
45 *
46 * @since 4.5.0
47 * @return string The default column width.
48 */
49 protected function get_default_length(): string {
50 return self::DEFAULT_COLUMN_WIDTH;
51 }
52
53 /**
54 * The CSS custom property this attribute is emitted as.
55 *
56 * @since 4.5.0
57 * @return string The custom property name.
58 */
59 protected function get_css_property(): string {
60 return '--alphalisting-column-width';
61 }
62
63 /**
64 * Store the sanitized column width.
65 *
66 * @since 4.5.0
67 * @param string $length The sanitized CSS length.
68 * @return void
69 */
70 protected function set_length( string $length ) {
71 $this->column_width = $length;
72 }
73
74 /**
75 * Retrieve the configured column width.
76 *
77 * @since 4.5.0
78 * @return string The column width.
79 */
80 protected function get_length(): string {
81 return $this->column_width;
82 }
83 }
84