当前位置: 首页>>代码示例>>PHP>>正文


PHP DBField::getLinkmode方法代码示例

本文整理汇总了PHP中DBField::getLinkmode方法的典型用法代码示例。如果您正苦于以下问题:PHP DBField::getLinkmode方法的具体用法?PHP DBField::getLinkmode怎么用?PHP DBField::getLinkmode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBField的用法示例。


在下文中一共展示了DBField::getLinkmode方法的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);
         }
     }
 }
开发者ID:helpfulrobot,项目名称:micschk-silverstripe-namedlinkfield,代码行数:46,代码来源:NamedLinkField.php


注:本文中的DBField::getLinkmode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。