本文整理汇总了PHP中DBField::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP DBField::getTitle方法的具体用法?PHP DBField::getTitle怎么用?PHP DBField::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBField
的用法示例。
在下文中一共展示了DBField::getTitle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setValue
/**
* Set the value of this field in various formats.
* Used by {@link DataObject->getField()}, {@link DataObject->setCastedField()}
* {@link DataObject->dbObject()} and {@link DataObject->write()}.
*
* As this method is used both for initializing the field after construction,
* and actually changing its values, it needs a {@link $markChanged}
* parameter.
*
* @param DBField|array $value
* @param array $record Map of values loaded from the database
* @param boolean $markChanged Indicate wether this field should be marked changed.
* Set to FALSE if you are initializing this field after construction, rather
* than setting a new value.
*/
public function setValue($value, $record = null, $markChanged = true)
{
if ($value instanceof NamedLinkField && $value->exists()) {
$this->setPageID($value->getPageID(), $markChanged);
$this->setCustomURL($value->getCustomURL(), $markChanged);
$this->setTitle($value->getTitle(), $markChanged);
$this->setLinkmode($value->getLinkmode(), $markChanged);
} elseif ($record && (isset($record[$this->name . 'PageID']) || isset($record[$this->name . 'CustomURL']) || isset($record[$this->name . 'Title']) || isset($record[$this->name . 'Linkmode']))) {
$this->setPageID(isset($record[$this->name . 'PageID']) ? $record[$this->name . 'PageID'] : null, $markChanged);
$this->setCustomURL(isset($record[$this->name . 'CustomURL']) ? $record[$this->name . 'CustomURL'] : null, $markChanged);
$this->setTitle(isset($record[$this->name . 'Title']) ? $record[$this->name . 'Title'] : null, $markChanged);
$this->setLinkmode(isset($record[$this->name . 'Linkmode']) ? $record[$this->name . 'Linkmode'] : null, $markChanged);
} else {
if (is_array($value)) {
if (array_key_exists('PageID', $value)) {
$this->setPageID($value['PageID'], $markChanged);
}
if (array_key_exists('CustomURL', $value)) {
$this->setCustomURL($value['CustomURL'], $markChanged);
}
if (array_key_exists('Title', $value)) {
$this->setTitle($value['Title'], $markChanged);
}
if (array_key_exists('Linkmode', $value)) {
$this->setLinkmode($value['Linkmode'], $markChanged);
}
} else {
// user_error('Invalid value in LinkField->setValue()', E_USER_ERROR);
}
}
}