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 / ColumnTypeRepository.php
codepress-admin-columns / classes Last commit date
Acf 1 day ago Admin 1 day ago Ajax 1 day ago ApplyFilter 1 day ago Asset 1 day ago Capabilities 1 day ago Check 1 day ago Collection 1 day ago Column 1 day ago ColumnFactories 1 day ago ColumnFactory 1 day ago ColumnIterator 1 day ago ColumnRepository 1 day ago ColumnSize 1 day ago DI 1 day ago DefaultColumnHandler 1 day ago Deprecated 1 day ago Entity 1 day ago Exception 1 day ago Expression 1 day ago Form 1 day ago Formatter 1 day ago Helper 1 day ago Integration 1 day ago ListScreenRepository 1 day ago ListTable 1 day ago Message 1 day ago Meta 1 day ago Nonce 1 day ago Notice 1 day ago Plugin 1 day ago Preferences 1 day ago Promo 1 day ago Request 1 day ago RequestHandler 1 day ago Response 1 day ago Sanitize 1 day ago Service 1 day ago Setting 1 day ago Settings 1 day ago Storage 1 day ago Table 1 day ago TableIdsFactory 1 day ago TableScreen 1 day ago TableScreenFactory 1 day ago ThirdParty 1 day ago Type 1 day ago Value 1 day ago View 1 day ago Acf.php 1 day ago AdminColumns.php 1 day ago ArrayIterator.php 1 day ago Capabilities.php 1 day ago Collection.php 1 day ago CollectionFormatter.php 1 day ago Column.php 1 day ago ColumnCollection.php 1 day ago ColumnFactoryCollectionFactory.php 1 day ago ColumnFactoryDefinitionCollection.php 1 day ago ColumnGroups.php 1 day ago ColumnIterator.php 1 day ago ColumnNamesTrait.php 1 day ago ColumnRepository.php 1 day ago ColumnTypeRepository.php 1 day ago Config.php 1 day ago DateFormats.php 1 day ago DefaultColumnHandler.php 1 day ago Expirable.php 1 day ago Formatter.php 1 day ago FormatterCollection.php 1 day ago Helper.php 1 day ago ListScreen.php 1 day ago ListScreenCollection.php 1 day ago ListScreenRepository.php 1 day ago ListScreenRepositoryWritable.php 1 day ago ListTable.php 1 day ago ListTableFactory.php 1 day ago Loader.php 1 day ago Message.php 1 day ago MetaType.php 1 day ago Middleware.php 1 day ago OpCacheInvalidateTrait.php 1 day ago PluginActionLinks.php 1 day ago PluginActionUpgrade.php 1 day ago PostType.php 1 day ago PostTypeRepository.php 1 day ago Registerable.php 1 day ago Registry.php 1 day ago Renderable.php 1 day ago Request.php 1 day ago RequestAjaxHandler.php 1 day ago RequestAjaxHandlers.php 1 day ago RequestAjaxParser.php 1 day ago RequestHandler.php 1 day ago RequestHandlerFactory.php 1 day ago Screen.php 1 day ago Services.php 1 day ago TableIdsFactory.php 1 day ago TableScreen.php 1 day ago TableScreenFactory.php 1 day ago Taxonomy.php 1 day ago Transient.php 1 day ago TypedArrayIterator.php 1 day ago View.php 1 day ago WooCommerce.php 1 day ago WpListTableFactory.php 1 day ago
ColumnTypeRepository.php
101 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AC;
6
7 use AC\Collection\ColumnFactories;
8 use AC\Column\ColumnFactory;
9 use AC\ColumnFactories\Aggregate;
10 use AC\Storage\Repository\OriginalColumnsRepository;
11 use AC\Type\TableId;
12
13 class ColumnTypeRepository
14 {
15 private Aggregate $aggregate;
16
17 private OriginalColumnsRepository $original_columns_repository;
18
19 public function __construct(Aggregate $aggregate, OriginalColumnsRepository $original_columns_repository)
20 {
21 $this->aggregate = $aggregate;
22 $this->original_columns_repository = $original_columns_repository;
23 }
24
25 private function find_column_factory(ColumnFactories $factories, string $type): ?ColumnFactory
26 {
27 foreach ($factories as $column_factory) {
28 if ($type === $column_factory->get_column_type()) {
29 return $column_factory;
30 }
31 }
32
33 return null;
34 }
35
36 public function find(TableScreen $table_screen, string $type): ?Column
37 {
38 $factory = $this->find_column_factory($this->aggregate->create($table_screen), $type);
39
40 if (! $factory) {
41 return null;
42 }
43
44 return $factory->create(
45 new Setting\Config([
46 'label' => $factory->get_label(),
47 ])
48 );
49 }
50
51 public function find_all(TableScreen $table_screen): ColumnCollection
52 {
53 $columns = new ColumnCollection();
54
55 foreach ($this->aggregate->create($table_screen) as $factory) {
56 $columns->add($factory->create(new Setting\Config()));
57 }
58
59 return $columns;
60 }
61
62 private function get_originals(TableId $id): array
63 {
64 $column_names = [];
65
66 foreach ($this->original_columns_repository->find_all_cached($id) as $column) {
67 $column_names[$column->get_name()] = $column->get_label();
68 }
69
70 return $column_names;
71 }
72
73 public function find_all_original(TableScreen $table_screen): ColumnCollection
74 {
75 $columns = new ColumnCollection();
76
77 $originals = $this->get_originals($table_screen->get_id());
78
79 foreach ($this->aggregate->create($table_screen) as $factory) {
80 $type = $factory->get_column_type();
81 $label = $originals[$type] ?? null;
82
83 if (null === $label) {
84 continue;
85 }
86
87 $columns->add(
88 $factory->create(
89 new Setting\Config([
90 'name' => $type,
91 'label' => (string)$label,
92 ])
93 )
94 );
95 }
96
97 return $columns;
98 }
99
100 }
101