예제 #1
0
 /**
  * Load property from page type.
  *
  * @param  string $slug
  * @param  string $child_slug
  *
  * @return object
  */
 public function get_property($slug, $child_slug = '')
 {
     $content_type_id = papi_get_qs('page');
     if (empty($content_type_id)) {
         $property = null;
         $content_types = papi_get_all_content_types(['types' => 'option']);
         foreach ($content_types as $index => $content_type) {
             if ($property = $content_type->get_property($slug, $child_slug)) {
                 $this->option_type = $content_type;
                 break;
             }
         }
         if (is_null($property)) {
             return;
         }
         return $property;
     }
     $content_type = papi_get_content_type_by_id($content_type_id);
     if (!papi_is_option_type($content_type)) {
         return;
     }
     $this->option_type = $content_type;
     return $content_type->get_property($slug, $child_slug);
 }
예제 #2
0
파일: page.php 프로젝트: KristoferN/papi
/**
 * Check if `$obj` is a instanceof `Papi_Page_Type`.
 *
 * @param  mixed $obj
 *
 * @return bool
 */
function papi_is_page_type($obj)
{
    return $obj instanceof Papi_Page_Type && !papi_is_option_type($obj);
}