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
<?php
/**
* Check if `$obj` is a instanceof `Papi_Option_Type`.
*
* @param mixed $obj
*
* @return bool
*/
function papi_is_option_type( $obj ) {
return $obj instanceof Papi_Option_Type;
}
/**
* Check if option type exists.
*
* @param string $id
*
* @return bool
*/
function papi_option_type_exists( $id ) {
$exists = false;
$option_types = papi_get_all_entry_types( [
'types' => 'option'
] );
foreach ( $option_types as $option_type ) {
if ( $option_type->match_id( $id ) ) {
$exists = true;
break;
}
}
return $exists;
}