/** * Method to get the content types. * * @return array An array of JContentType objects. * * @since 12.1 * @throws RuntimeException */ public function getTypes() { $types = array(); // Get the cache store id. $storeId = $this->getStoreId('getTypes'); // Attempt to retrieve the types from cache first. $cached = $this->retrieve($storeId); // Check if the cached value is usable. if (is_array($cached)) { return $cached; } // Build the query to get the content types. $query = $this->db->getQuery(true); $query->select('a.*'); $query->from($query->qn('#__content_types') . ' AS a'); // Get the content types. $this->db->setQuery($query); $results = $this->db->loadObjectList(); // Reorganize the type information. foreach ($results as $result) { // Create a new JContentType object. $type = $this->factory->getType(); // Bind the type data. $type->bind($result); // Add the type, keyed by alias. $types[$result->alias] = $type; } // Store the types in cache. return $this->store($storeId, $types); }