Factory.php
796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace ACA\MetaBox\Search;
use ACA\MetaBox;
use ACA\MetaBox\Column;
use ACP\Search\Comparison;
abstract class Factory extends MetaBox\Factory {
public function create( Column $column ) {
switch ( true ) {
case $this instanceof CloneableFactory && $column->is_clonable():
$model = $this->create_cloneable( $column );
break;
default:
$model = $this->create_default( $column );
}
if ( $column->get_storage() === MetaBox\StorageAware::CUSTOM_TABLE ) {
if ( $model instanceof Comparison && $this instanceof TableStorageFactory ) {
$model = $this->create_table_storage( $column, $model );
} else {
$model = $this->create_disabled( $column );
}
}
return $model;
}
public function create_disabled( Column $column ) {
return false;
}
}