本文整理汇总了PHP中modResource::setProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP modResource::setProperty方法的具体用法?PHP modResource::setProperty怎么用?PHP modResource::setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modResource
的用法示例。
在下文中一共展示了modResource::setProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleResourceProperties
/**
* Handle any properties-specific fields
*/
public function handleResourceProperties()
{
if ($this->object->get('class_key') == 'modWebLink') {
$responseCode = $this->getProperty('responseCode');
if (!empty($responseCode)) {
$this->object->setProperty('responseCode', $responseCode);
}
}
}
示例2: saveMarkdown
private function saveMarkdown()
{
$resourceArray = $this->resource->toArray();
$mode = $this->sp['mode'];
$deleteUnused = (int) $this->md->getOption('upload.delete_unused', null, 1);
$underResource = (int) $this->md->getOption('upload.under_resource', null, 1);
if ($mode == \modSystemEvent::MODE_UPD) {
if ($deleteUnused && $underResource) {
$this->uploadedFiles();
}
}
foreach ($resourceArray as $field => $value) {
if (!strpos($field, '_markdown')) {
continue;
}
$fieldName = str_replace('_markdown', '', $field);
$markdown = $this->modx->fromJSON($this->resource->getProperty('markdown', 'markdowneditor', '[]'));
if ($mode == \modSystemEvent::MODE_NEW) {
if ($underResource) {
$this->moveFilesUnderCorrectResource($value, $fieldName);
}
}
if ($mode == \modSystemEvent::MODE_UPD) {
if ($deleteUnused && $underResource) {
$this->unsetUnusedFiles($value);
}
}
$markdown[$fieldName] = $value;
$this->resource->setProperty('markdown', $this->modx->toJSON($markdown), 'markdowneditor');
$this->resource->save();
$this->resource->{$field} = '';
}
if ($mode == \modSystemEvent::MODE_UPD) {
if ($deleteUnused && $underResource) {
$this->deleteUnusedFiles();
}
}
}