當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FieldStorageDefinitionInterface::isRevisionable方法代碼示例

本文整理匯總了PHP中Drupal\Core\Field\FieldStorageDefinitionInterface::isRevisionable方法的典型用法代碼示例。如果您正苦於以下問題:PHP FieldStorageDefinitionInterface::isRevisionable方法的具體用法?PHP FieldStorageDefinitionInterface::isRevisionable怎麽用?PHP FieldStorageDefinitionInterface::isRevisionable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Field\FieldStorageDefinitionInterface的用法示例。


在下文中一共展示了FieldStorageDefinitionInterface::isRevisionable方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createFromFieldStorageDefinition

 /**
  * Creates a new field definition based upon a field storage definition.
  *
  * In cases where one needs a field storage definitions to act like full
  * field definitions, this creates a new field definition based upon the
  * (limited) information available. That way it is possible to use the field
  * definition in places where a full field definition is required; e.g., with
  * widgets or formatters.
  *
  * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $definition
  *   The field storage definition to base the new field definition upon.
  *
  * @return $this
  */
 public static function createFromFieldStorageDefinition(FieldStorageDefinitionInterface $definition)
 {
     return static::create($definition->getType())->setCardinality($definition->getCardinality())->setConstraints($definition->getConstraints())->setCustomStorage($definition->hasCustomStorage())->setDescription($definition->getDescription())->setLabel($definition->getLabel())->setName($definition->getName())->setProvider($definition->getProvider())->setQueryable($definition->isQueryable())->setRequired($definition->isRequired())->setRevisionable($definition->isRevisionable())->setSettings($definition->getSettings())->setTargetEntityTypeId($definition->getTargetEntityTypeId())->setTranslatable($definition->isTranslatable());
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:18,代碼來源:FieldDefinition.php

示例2: requiresFieldStorageSchemaChanges

 /**
  * {@inheritdoc}
  */
 public function requiresFieldStorageSchemaChanges(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original)
 {
     $table_mapping = $this->storage->getTableMapping();
     if ($storage_definition->hasCustomStorage() != $original->hasCustomStorage() || $storage_definition->getSchema() != $original->getSchema() || $storage_definition->isRevisionable() != $original->isRevisionable() || $table_mapping->allowsSharedTableStorage($storage_definition) != $table_mapping->allowsSharedTableStorage($original) || $table_mapping->requiresDedicatedTableStorage($storage_definition) != $table_mapping->requiresDedicatedTableStorage($original)) {
         return TRUE;
     }
     if ($storage_definition->hasCustomStorage()) {
         // The field has custom storage, so we don't know if a schema change is
         // needed or not, but since per the initial checks earlier in this
         // function, nothing about the definition changed that we manage, we
         // return FALSE.
         return FALSE;
     }
     return $this->getSchemaFromStorageDefinition($storage_definition) != $this->loadFieldSchemaData($original);
 }
開發者ID:sgtsaughter,項目名稱:d8portfolio,代碼行數:18,代碼來源:SqlContentEntityStorageSchema.php

示例3: requiresFieldStorageSchemaChanges

 /**
  * {@inheritdoc}
  */
 public function requiresFieldStorageSchemaChanges(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original)
 {
     $table_mapping = $this->storage->getTableMapping();
     if ($storage_definition->hasCustomStorage() != $original->hasCustomStorage() || $storage_definition->getSchema() != $original->getSchema() || $storage_definition->isRevisionable() != $original->isRevisionable() || $table_mapping->allowsSharedTableStorage($storage_definition) != $table_mapping->allowsSharedTableStorage($original) || $table_mapping->requiresDedicatedTableStorage($storage_definition) != $table_mapping->requiresDedicatedTableStorage($original)) {
         return TRUE;
     }
     if ($table_mapping->requiresDedicatedTableStorage($storage_definition)) {
         return $this->getDedicatedTableSchema($storage_definition) != $this->loadFieldSchemaData($original);
     } elseif ($table_mapping->allowsSharedTableStorage($storage_definition)) {
         $field_name = $storage_definition->getName();
         $schema = array();
         foreach (array_diff($table_mapping->getTableNames(), $table_mapping->getDedicatedTableNames()) as $table_name) {
             if (in_array($field_name, $table_mapping->getFieldNames($table_name))) {
                 $column_names = $table_mapping->getColumnNames($storage_definition->getName());
                 $schema[$table_name] = $this->getSharedTableFieldSchema($storage_definition, $table_name, $column_names);
             }
         }
         return $schema != $this->loadFieldSchemaData($original);
     } else {
         // The field has custom storage, so we don't know if a schema change is
         // needed or not, but since per the initial checks earlier in this
         // function, nothing about the definition changed that we manage, we
         // return FALSE.
         return FALSE;
     }
 }
開發者ID:RealLukeMartin,項目名稱:drupal8tester,代碼行數:29,代碼來源:SqlContentEntityStorageSchema.php


注:本文中的Drupal\Core\Field\FieldStorageDefinitionInterface::isRevisionable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。