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


PHP SS_List::dataClass方法代码示例

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


在下文中一共展示了SS_List::dataClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Usage [e.g. in getCMSFields]
  *    $field = new PickerField('Authors', 'Selected Authors', $this->Authors(), 'Select Author(s)');
  *     
  * @param string $name              - Name of field (typically the relationship method)
  * @param string $title             - GridField Title
  * @param SS_List $dataList         - Result of the relationship component method (E.g. $this->Authors())
  * @param string $linkExistingTitle - AddExisting Button Title
  * @param string $sortField         - Field to sort on. Be sure it exists in the $many_many_extraFields static
  */
 public function __construct($name, $title = null, SS_List $dataList = null, $linkExistingTitle = null, $sortField = null)
 {
     $config = GridfieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldToolbarHeader(), new GridFieldDataColumns(), new GridFieldTitleHeader(), new GridFieldPaginator(), new PickerFieldAddExistingSearchButton(), new PickerFieldDeleteAction());
     if ($sortField) {
         $config->addComponent(new GridFieldOrderableRows($sortField));
     }
     if (!$linkExistingTitle) {
         $linkExistingTitle = $this->isHaveOne() ? 'Select a ' . $dataList->dataClass() : 'Select ' . $dataList->dataClass() . '(s)';
         // plural [has_many, many_many]
     }
     $config->getComponentByType('PickerFieldAddExistingSearchButton')->setTitle($linkExistingTitle);
     return parent::__construct($name, $title, $dataList, $config);
 }
开发者ID:helpfulrobot,项目名称:briceburg-silverstripe-pickerfield,代码行数:23,代码来源:PickerField.php

示例2: getModelClass

 /**
  * Returns a data class that is a DataObject type that this GridField should look like.
  *
  * @return string
  *
  * @throws LogicException
  */
 public function getModelClass()
 {
     if ($this->modelClassName) {
         return $this->modelClassName;
     }
     if ($this->list && method_exists($this->list, 'dataClass')) {
         $class = $this->list->dataClass();
         if ($class) {
             return $class;
         }
     }
     throw new LogicException('GridField doesn\'t have a modelClassName, so it doesn\'t know the columns of this grid.');
 }
开发者ID:miamollie,项目名称:echoAerial,代码行数:20,代码来源:GridField.php

示例3: getModelClasses

 /**
  * @return array
  */
 public function getModelClasses()
 {
     if ($this->modelClassNames) {
         return $this->modelClassNames;
     }
     if ($this->list && method_exists($this->list, 'dataClass')) {
         $class = $this->list->dataClass();
         if ($class) {
             if (!is_array($class)) {
                 $class = array($class);
             }
             return static::convert_to_associative($class);
         }
     }
     return array();
 }
开发者ID:silbinarywolf,项目名称:multirecordfield,代码行数:19,代码来源:MultiRecordField.php

示例4: getSortTable

 /**
  * Gets the table which contains the sort field.
  *
  * @param DataList $list
  * @return string
  */
 public function getSortTable(SS_List $list)
 {
     $field = $this->getSortField();
     if ($list instanceof ManyManyList) {
         $extra = $list->getExtraFields();
         $table = $list->getJoinTable();
         if ($extra && array_key_exists($field, $extra)) {
             return $table;
         }
     }
     $classes = ClassInfo::dataClassesFor($list->dataClass());
     foreach ($classes as $class) {
         if (singleton($class)->hasOwnTableDatabaseField($field)) {
             return $class;
         }
     }
     throw new Exception("Couldn't find the sort field '{$field}'");
 }
开发者ID:ajshort,项目名称:silverstripe-gridfieldextensions,代码行数:24,代码来源:GridFieldOrderableRows.php


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