本文整理汇总了PHP中JUcmType::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP JUcmType::getType方法的具体用法?PHP JUcmType::getType怎么用?PHP JUcmType::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUcmType
的用法示例。
在下文中一共展示了JUcmType::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getQuery
/**
* 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;
}
示例2: testGetType
/**
* 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');
}