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


PHP FieldStorageConfig::getType方法代码示例

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


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

示例1: hook_rdf_apply_default_fields_alter

/**
 * Alters the field configuration for fields related to rdf entities.
 *
 * @param \Drupal\field\Entity\FieldStorageConfig $storage
 *   The field configuration storage entity.
 * @param array &$values
 *   An associative array of field values. This array include any additional
 *   data a field formatter includes.
 *
 * @ingroup rdf_entity_api
 */
function hook_rdf_apply_default_fields_alter(\Drupal\field\Entity\FieldStorageConfig $storage, &$values)
{
    if ($storage->getType() == 'text_long') {
        // Handle multiple values in a field.
        foreach ($values as &$value) {
            $value['format'] == 'my_custom_persistent_filter';
        }
    }
}
开发者ID:ec-europa,项目名称:joinup-dev,代码行数:20,代码来源:rdf_entity.api.php

示例2: applyFieldDefaults

 /**
  * Allow overrides for some field types.
  *
  * @param FieldStorageConfig $storage
  *   Field storage configuration.
  * @param array $values
  *   The field values.
  */
 private function applyFieldDefaults(FieldStorageConfig $storage, &$values)
 {
     if (empty($values)) {
         return;
     }
     foreach ($values as &$value) {
         // Textfield: provide default filter when filter not mapped.
         switch ($storage->getType()) {
             case 'text_long':
                 if (!isset($value['format'])) {
                     $value['format'] = 'full_html';
                 }
                 break;
                 // Strip timezone part in dates.
             // Strip timezone part in dates.
             case 'datetime':
                 $time_stamp = strtotime($value['value']);
                 $date = date('o-m-d', $time_stamp) . "T" . date('H:i:s', $time_stamp);
                 $value['value'] = $date;
                 break;
         }
     }
     $this->moduleHandler->alter('rdf_apply_default_fields', $storage, $values);
 }
开发者ID:ec-europa,项目名称:joinup-dev,代码行数:32,代码来源:RdfEntitySparqlStorage.php

示例3: buildRow

 /**
  * XXXXX.
  * @param \Drupal\field\Entity\FieldStorageConfig $field_storage.
  * @return array
  *   xxx
  */
 protected function buildRow(FieldStorageConfig $field_storage)
 {
     $row = [];
     if ($field_storage->isLocked()) {
         $row[0]['class'] = array('menu-disabled');
         $row[0]['data']['id'] = $this->t('@field_name (Locked)', array('@field_name' => $field_storage->getName()));
     } else {
         $row[0]['data'] = $field_storage->getName();
     }
     $row[1]['data'] = $field_storage->getType();
     $row[2]['data'] = $field_storage->getTargetEntityTypeId();
     $row[3]['data'] = implode(",", $field_storage->getBundles());
     $default_type = $this->fieldPermissions->fieldGetPermissionType($field_storage);
     if ($default_type == FIELD_PERMISSIONS_PUBLIC) {
         $row[4]['data'] = t("Public field (author and administrators can edit, everyone can view)");
         $row[4]['colspan'] = 5;
     } elseif ($default_type == FIELD_PERMISSIONS_PRIVATE) {
         $row[4]['data'] = t("Private field (only author and administrators can edit and view)");
         $row[4]['colspan'] = 5;
     } elseif ($default_type == FIELD_PERMISSIONS_CUSTOM) {
         $row[4]['data'] = t("Custom field Permission ()");
         $row[4]['colspan'] = 5;
     }
     return $row;
 }
开发者ID:drugo32,项目名称:field_permissions,代码行数:31,代码来源:FieldPermissionsController.php


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