本文整理汇总了PHP中JApplicationWeb::triggerEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP JApplicationWeb::triggerEvent方法的具体用法?PHP JApplicationWeb::triggerEvent怎么用?PHP JApplicationWeb::triggerEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JApplicationWeb
的用法示例。
在下文中一共展示了JApplicationWeb::triggerEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Method to update an object in the database.
*
* @return JContent The content object.
*
* @since 12.1
* @throws LogicException
* @throws RuntimeException
*/
public function update()
{
// Assert the object is loaded.
$this->assertIsLoaded();
// Make sure the item is checked out.
// $this->checkout();
// Check for an alias.
if (empty($this->alias)) {
$this->alias = $this->title;
}
// Sanitize the alias.
$this->alias = JFilterOutput::stringURLSafe($this->alias);
// Update the last modified data for the content.
$this->modified_date = JDate::getInstance();
$this->modified_user_id = !$this->user->get('guest') ? (int) $this->user->get('content_id') : null;
// Update the revision number.
if (!$this->isTemporary()) {
$this->revision += 1;
}
// Check the content object.
$this->validate();
// Trigger the before update event.
$this->app->triggerEvent('onContentBeforeUpdate', array($this));
// Perform the actual database updates.
$this->doUpdate();
// Trigger the after update event.
$this->app->triggerEvent('onContentAfterUpdate', array($this));
return $this;
}
示例2: getForm
/**
* Gets a content form.
*
* @param string $type The content type.
*
* @return JForm The form object.
*
* @since 12.1
* @throws RuntimeException
*/
public function getForm($type)
{
// Get the form name.
$name = 'JContent' . $type;
try {
// Get the base form.
$form = JForm::getInstance($name, 'content', array('control' => 'jform'));
// Load the type form.
$form->loadFile($type, false, false);
// Trigger the form preparation event.
$this->app->triggerEvent('onContentPrepareForm', array($form));
} catch (Exception $error) {
throw new RuntimeException($error->getMessage(), $error->getCode(), $error);
}
return $form;
}