PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 7.1.4
Admin Columns v7.1.4
7.1.4 7.0.19 2.3.5 2.4 2.4.1 2.4.10 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.6.1 2.5.6.2 2.5.6.3 2.5.6.4 3.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.7 3.1 3.1.1 3.1.10 3.1.2 3.1.3 3.1.5 3.2.3 3.2.7 3.3.1 3.4.1 3.4.6 3.4.8 4.0.1 4.0.3 4.1.6 4.2.2 4.2.5 4.3 4.3.2 4.4.1 4.4.4 4.4.5 4.5.5 4.6.1 4.7.18 4.7.19 4.7.20 4.7.7 7.0.13 7.0.14 7.0.16 trunk 1.0 1.1 1.1.3 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.5.1 1.4.6 1.4.6.1 1.4.6.2 1.4.6.3 1.4.6.4 1.4.7 1.4.8 1.4.9 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.1.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.5.1 2.2.6 2.2.6.1 2.2.6.2 2.2.6.3 2.2.6.4 2.2.7 2.2.8 2.2.8.1 2.2.9 2.3.1 2.3.2 2.3.3
codepress-admin-columns / classes / Setting / ComponentFactory / StringLimit.php
codepress-admin-columns / classes / Setting / ComponentFactory Last commit date
DateFormat 2 days ago FieldTypeConfigurator 2 days ago Media 2 days ago Post 2 days ago Pro 2 days ago ActionIcons.php 2 days ago AttachmentDisplay.php 2 days ago BaseComponentFactory.php 2 days ago BeforeAfter.php 2 days ago BooleanValues.php 2 days ago CharacterLimit.php 2 days ago ColumnInfo.php 2 days ago CommentDisplay.php 2 days ago CommentLink.php 2 days ago CommentStatus.php 2 days ago CustomField.php 2 days ago CustomFieldFactory.php 2 days ago DateFormat.php 2 days ago DateSaveFormat.php 2 days ago ExifData.php 2 days ago FieldType.php 2 days ago FieldTypeFactory.php 2 days ago FieldTypeFactoryBuilder.php 2 days ago FileDisplay.php 2 days ago FileLink.php 2 days ago FilePreviewSize.php 2 days ago HiddenInput.php 2 days ago HiddenLabel.php 2 days ago ImageSize.php 2 days ago ImageSizeBase.php 2 days ago IncludeMissingSizes.php 2 days ago InputNameAware.php 2 days ago IsLink.php 2 days ago IsLinkable.php 2 days ago IsMultiple.php 2 days ago Label.php 2 days ago LinkLabel.php 2 days ago LinkToMenu.php 2 days ago LinkablePostProperty.php 2 days ago MediaLink.php 2 days ago Message.php 2 days ago ModalDisplay.php 2 days ago Name.php 2 days ago NumberFormat.php 2 days ago NumberOfItems.php 2 days ago Password.php 2 days ago PathScope.php 2 days ago PostExtendedProperty.php 2 days ago PostLink.php 2 days ago PostProperty.php 2 days ago PostStatus.php 2 days ago PostStatusIcon.php 2 days ago PostType.php 2 days ago PostTypeFactory.php 2 days ago RelatedUserMetaField.php 2 days ago SelectOptions.php 2 days ago Separator.php 2 days ago SerializedArrayKeys.php 2 days ago SerializedDisplay.php 2 days ago StringLimit.php 2 days ago Taxonomy.php 2 days ago TaxonomyFactory.php 2 days ago TermLink.php 2 days ago TermProperty.php 2 days ago UseIcon.php 2 days ago UserLink.php 2 days ago UserLinkFactory.php 2 days ago UserProperty.php 2 days ago VideoDisplay.php 2 days ago Width.php 2 days ago WordLimit.php 2 days ago WordsPerMinute.php 2 days ago
StringLimit.php
65 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AC\Setting\ComponentFactory;
6
7 use AC\Expression\StringComparisonSpecification;
8 use AC\Setting\Children;
9 use AC\Setting\ComponentCollection;
10 use AC\Setting\Config;
11 use AC\Setting\Control\Input;
12 use AC\Setting\Control\Input\OptionFactory;
13 use AC\Setting\Control\OptionCollection;
14
15 final class StringLimit extends BaseComponentFactory
16 {
17 private const OPTION_CHARACTER = 'character_limit';
18 private const OPTION_WORD = 'word_limit';
19
20 private CharacterLimit $character_limit;
21
22 private WordLimit $word_limit;
23
24 public function __construct(CharacterLimit $character_limit, WordLimit $word_limit)
25 {
26 $this->character_limit = $character_limit;
27 $this->word_limit = $word_limit;
28 }
29
30 protected function get_label(Config $config): ?string
31 {
32 return __('Text Limit', 'codepress-admin-columns');
33 }
34
35 protected function get_input(Config $config): ?Input
36 {
37 return OptionFactory::create_select(
38 'string_limit',
39 OptionCollection::from_array([
40 '' => __('No limit', 'codepress-admin-columns'),
41 self::OPTION_CHARACTER => __('Character Limit', 'codepress-admin-columns'),
42 self::OPTION_WORD => __('Word Limit', 'codepress-admin-columns'),
43 ]),
44 $config->get('string_limit', self::OPTION_WORD)
45 );
46 }
47
48 protected function get_children(Config $config): ?Children
49 {
50 return new Children(
51 new ComponentCollection([
52 $this->character_limit->create(
53 $config,
54 StringComparisonSpecification::equal(self::OPTION_CHARACTER)
55 ),
56 $this->word_limit->create(
57 $config,
58 StringComparisonSpecification::equal(self::OPTION_WORD)
59 ),
60 ])
61 );
62 }
63
64 }
65