本文整理汇总了PHP中CustomFields::updateCustomField方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomFields::updateCustomField方法的具体用法?PHP CustomFields::updateCustomField怎么用?PHP CustomFields::updateCustomField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomFields
的用法示例。
在下文中一共展示了CustomFields::updateCustomField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CustomFields
/**
* checks if the fields already exist and if so, disables them (sets them to be "hidden")
*/
function _updateFields()
{
$customFields = new CustomFields();
$blogFields = $customFields->getBlogCustomFields($this->_blogInfo->getId());
// check if the checkbox fields exists
if (array_key_exists("password_protected", $blogFields)) {
_debug("hiding! password field!");
$protectedField = $blogFields["password_protected"];
$protectedField->setHidden(true);
$customFields->updateCustomField($protectedField);
}
// check if the field for the password exists
if (array_key_exists("password_field", $blogFields)) {
_debug("hiding! pass-word field!");
$passwordField = $blogFields["password_field"];
$passwordField->setHidden(true);
$customFields->updateCustomField($passwordField);
}
return true;
}
示例2: perform
/**
* Carries out the specified action
*/
function perform()
{
// fetch the fields from the request
$this->_fieldId = $this->_request->getValue("fieldId");
$this->_fieldName = Textfilter::filterAllHTML($this->_request->getValue("fieldName"));
$this->_fieldDescription = Textfilter::filterAllHTML($this->_request->getValue("fieldDescription"));
$this->_fieldType = $this->_request->getValue("fieldType");
$this->_fieldSearchable = $this->_request->getValue("fieldSearchable");
$this->_fieldHidden = $this->_request->getValue("fieldHidden");
// and start to update the field
$fields = new CustomFields();
$field = $fields->getCustomField($this->_fieldId);
// view that we're going to use for all different flows...
$this->_view = new AdminCustomFieldsListView($this->_blogInfo);
// field couldn't be loaded...
if (!$field) {
$this->_view->setErrorMessage($this->_locale->tr("error_updating_custom_field"));
return false;
}
// ...update its information...
$field->setName($this->_fieldName);
$field->setDescription($this->_fieldDescription);
$field->setType($this->_fieldType);
$field->setHidden($this->_fieldHidden);
// fire the pre-event
$this->notifyEvent(EVENT_PRE_CUSTOM_FIELD_UPDATE, array("field" => &$field));
// ...and finally the data in the database
$result = $fields->updateCustomField($field);
// check the result
if (!$result) {
$this->_view->setErrorMessage($this->_locale->tr("error_updating_custom_field"));
} else {
$this->_view->setSuccessMessage($this->_locale->pr("custom_field_updated_ok", $field->getName()));
// fire the post-event
$this->notifyEvent(EVENT_POST_CUSTOM_FIELD_UPDATE, array("field" => &$field));
}
$this->setCommonData();
return true;
}