check if is a valid key, remove old code
This commit is contained in:
parent
a9698cb3f6
commit
63e23420bb
|
@ -85,12 +85,14 @@ class Exposers {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function check_class_name($class_name, $root = false, $prefix = 'Tainacan\Exposers\Types\\') {
|
public function check_class_name($class_name, $root = false, $prefix = 'Tainacan\Exposers\Types\\') {
|
||||||
if(array_key_exists($class_name, $this->types)) {
|
if(is_string($class_name)) {
|
||||||
$class_name = $this->types[$class_name];
|
if(array_key_exists($class_name, $this->types)) {
|
||||||
$prefix = '';
|
$class_name = $this->types[$class_name];
|
||||||
} elseif( array_key_exists($class_name, $this->mappers)) {
|
$prefix = '';
|
||||||
$class_name = $this->mappers[$class_name];
|
} elseif( array_key_exists($class_name, $this->mappers)) {
|
||||||
$prefix = '';
|
$class_name = $this->mappers[$class_name];
|
||||||
|
$prefix = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$class = $prefix.sanitize_text_field($class_name);
|
$class = $prefix.sanitize_text_field($class_name);
|
||||||
$class = str_replace(['-', ' '], ['_', '_'], $class);
|
$class = str_replace(['-', ' '], ['_', '_'], $class);
|
||||||
|
@ -231,8 +233,6 @@ class Exposers {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function has_mapper($mapper) {
|
public function has_mapper($mapper) {
|
||||||
if(array_key_exists($mapper, $this->mappers)) return true;
|
|
||||||
|
|
||||||
return in_array($this->check_class_name($mapper, false, self::MAPPER_CLASS_PREFIX), $this->mappers);
|
return in_array($this->check_class_name($mapper, false, self::MAPPER_CLASS_PREFIX), $this->mappers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue