/** * Builds the query for the ordering list. * * @return JDatabaseQuery The query for the ordering form field * * @since 3.2 */ protected function getQuery() { $categoryId = (int) $this->form->getValue('catid'); $contentType = (string) $this->element['content_type']; $ucmType = new JUcmType(); $ucmRow = $ucmType->getType($ucmType->getTypeId($contentType)); $ucmMapCommon = json_decode($ucmRow->field_mappings)->common; if (is_object($ucmMapCommon)) { $ordering = $ucmMapCommon->core_ordering; $title = $ucmMapCommon->core_title; } elseif (is_array($ucmMapCommon)) { $ordering = $ucmMapCommon[0]->core_ordering; $title = $ucmMapCommon[0]->core_title; } $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select(array($db->quoteName($ordering, 'value'), $db->quoteName($title, 'text')))->from($db->quoteName(json_decode($ucmRow->table)->special->dbtable))->where($db->quoteName('catid') . ' = ' . (int) $categoryId)->order('ordering'); return $query; }
/** * Tests the getType() method * * @return void * * @since 3.2 */ public function testGetType() { $this->assertEquals(1, $this->object->getType()->type_id, 'Articles are type_id = 1'); }