本文整理汇总了PHP中FinderIndexerHelper::addContentType方法的典型用法代码示例。如果您正苦于以下问题:PHP FinderIndexerHelper::addContentType方法的具体用法?PHP FinderIndexerHelper::addContentType怎么用?PHP FinderIndexerHelper::addContentType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FinderIndexerHelper
的用法示例。
在下文中一共展示了FinderIndexerHelper::addContentType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAddContentType
/**
* Tests the addContentType method
*
* @return void
*
* @since 3.1
*/
public function testAddContentType()
{
$this->assertThat(FinderIndexerHelper::addContentType('Article'), $this->equalTo('4'), 'Tests that addContentType returns the ID for an already existing type.');
$existingIds = array('1', '2', '3', '4', '5', '6');
$newTypeId = FinderIndexerHelper::addContentType('PHPUnit');
$this->assertFalse(in_array($newTypeId, $existingIds), 'Tests that the new ID does not already exist in the database.');
}
示例2: __construct
/**
* Method to instantiate the indexer adapter.
*
* @param object &$subject The object to observe.
* @param array $config An array that holds the plugin configuration.
*
* @since 2.5
*/
public function __construct(&$subject, $config)
{
// Get the database object.
$this->db = JFactory::getDbo();
// Call the parent constructor.
parent::__construct($subject, $config);
// Get the type id.
$this->type_id = $this->getTypeId();
// Add the content type if it doesn't exist and is set.
if (empty($this->type_id) && !empty($this->type_title)) {
$this->type_id = FinderIndexerHelper::addContentType($this->type_title, $this->mime);
}
// Check for a layout override.
if ($this->params->get('layout')) {
$this->layout = $this->params->get('layout');
}
// Get the indexer object
$this->indexer = FinderIndexer::getInstance();
}