FieldGroup
2 days ago
RequestHandler
2 days ago
Service
2 days ago
AcfColumnFactory.php
2 days ago
ColumnMatcher.php
2 days ago
FieldGroupCache.php
2 days ago
ColumnMatcher.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Acf; |
| 6 | |
| 7 | use AC\Column; |
| 8 | use AC\ListScreen; |
| 9 | |
| 10 | class ColumnMatcher |
| 11 | { |
| 12 | public function find_column(ListScreen $list_screen, string $meta_key): ?Column |
| 13 | { |
| 14 | foreach ($list_screen->get_columns() as $column) { |
| 15 | if ($column->get_type() !== 'column-meta') { |
| 16 | continue; |
| 17 | } |
| 18 | |
| 19 | $setting = $column->get_setting('field'); |
| 20 | |
| 21 | if ($setting && $setting->has_input() && (string)$setting->get_input()->get_value() === $meta_key) { |
| 22 | return $column; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | return null; |
| 27 | } |
| 28 | |
| 29 | } |
| 30 |