public function mb_object_type()
{
if (null !== $this->mb_object_type) {
return $this->mb_object_type;
}
if ($this->is_options_page_mb()) {
$this->mb_object_type = 'options-page';
return $this->mb_object_type;
}
$registered_types = $this->prop('object_types');
if (!$registered_types) {
$this->mb_object_type = 'post';
return $this->mb_object_type;
}
$type = false;
// check if 'object_types' is a string
if (is_string($registered_types)) {
$type = $registered_types;
} elseif (is_array($registered_types) && 1 === count($registered_types)) {
$last = end($registered_types);
if (is_string($last)) {
$type = $last;
}
} elseif (is_array($registered_types)) {
$page_type = $this->current_object_type();
if (in_array($page_type, $registered_types, true)) {
$type = $page_type;
}
}
// Get our object type
switch ($type) {
case 'user':
case 'comment':
case 'term':
$this->mb_object_type = $type;
break;
default:
$this->mb_object_type = 'post';
break;
}
return $this->mb_object_type;
}