本文整理汇总了PHP中Drupal\Core\Field\FieldStorageDefinitionInterface::getSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldStorageDefinitionInterface::getSetting方法的具体用法?PHP FieldStorageDefinitionInterface::getSetting怎么用?PHP FieldStorageDefinitionInterface::getSetting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Field\FieldStorageDefinitionInterface
的用法示例。
在下文中一共展示了FieldStorageDefinitionInterface::getSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: schema
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition)
{
$foreign_keys = array();
// The 'foreign keys' key is not always used in tests.
if ($field_definition->getSetting('foreign_key_name')) {
$foreign_keys['foreign keys'] = array($field_definition->getSetting('foreign_key_name') => array('table' => $field_definition->getSetting('foreign_key_name'), 'columns' => array($field_definition->getSetting('foreign_key_name') => 'id')));
}
return array('columns' => array('shape' => array('type' => 'varchar', 'length' => 32), 'color' => array('type' => 'varchar', 'length' => 32))) + $foreign_keys;
}
示例2: propertyDefinitions
/**
* {@inheritdoc}
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition)
{
// This is called very early by the user entity roles field. Prevent
// early t() calls by using the TranslationWrapper.
$properties['value'] = DataDefinition::create('string')->setLabel(new TranslationWrapper('Text value'))->setSetting('case_sensitive', $field_definition->getSetting('case_sensitive'))->setRequired(TRUE);
return $properties;
}
示例3: schema
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition)
{
$type = $field_definition->getSetting('data_type');
$schema = array('columns' => array('value' => array('type' => $type)));
if ($type == 'varchar') {
$schema['columns']['value']['length'] = (int) $field_definition->getSetting('data_length');
}
if ($type == 'text' || $type == 'int' || $type == 'float') {
$schema['columns']['value']['size'] = $field_definition->getSetting('data_size');
}
if ($type == 'decimal') {
$schema['columns']['value']['precision'] = (int) $field_definition->getSetting('data_precision');
$schema['columns']['value']['scale'] = (int) $field_definition->getSetting('data_scale');
}
return $schema;
}
示例4: schema
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field)
{
$backendManager = \Drupal::service('plugin.manager.geofield_backend');
$backendPlugin = NULL;
if (isset($field->settings['backend']) && $backendManager->getDefinition($field->settings['backend']) != NULL) {
$backendPlugin = $backendManager->createInstance($field->getSetting('backend'));
}
if ($backendPlugin === NULL) {
$backendPlugin = $backendManager->createInstance('geofield_backend_default');
}
return array('columns' => array('value' => $backendPlugin->schema(), 'geo_type' => array('type' => 'varchar', 'default' => '', 'length' => 64), 'lat' => array('type' => 'numeric', 'precision' => 18, 'scale' => 12, 'not null' => FALSE), 'lon' => array('type' => 'numeric', 'precision' => 18, 'scale' => 12, 'not null' => FALSE), 'left' => array('type' => 'numeric', 'precision' => 18, 'scale' => 12, 'not null' => FALSE), 'top' => array('type' => 'numeric', 'precision' => 18, 'scale' => 12, 'not null' => FALSE), 'right' => array('type' => 'numeric', 'precision' => 18, 'scale' => 12, 'not null' => FALSE), 'bottom' => array('type' => 'numeric', 'precision' => 18, 'scale' => 12, 'not null' => FALSE), 'geohash' => array('type' => 'varchar', 'length' => GEOFIELD_GEOHASH_LENGTH, 'not null' => FALSE)), 'indexes' => array('lat' => array('lat'), 'lon' => array('lon'), 'top' => array('top'), 'bottom' => array('bottom'), 'left' => array('left'), 'right' => array('right'), 'geohash' => array('geohash'), 'centroid' => array('lat', 'lon'), 'bbox' => array('top', 'bottom', 'left', 'right')));
}
示例5: schema
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition)
{
$target_type = $field_definition->getSetting('target_type');
$target_type_info = \Drupal::entityManager()->getDefinition($target_type);
if ($target_type_info->isSubclassOf('\\Drupal\\Core\\Entity\\FieldableEntityInterface')) {
$columns = array('target_id' => array('description' => 'The ID of the target entity.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE));
} else {
$columns = array('target_id' => array('description' => 'The ID of the target entity.', 'type' => 'varchar', 'length' => $target_type_info->getBundleOf() ? EntityTypeInterface::BUNDLE_MAX_LENGTH : 255));
}
$schema = array('columns' => $columns, 'indexes' => array('target_id' => array('target_id')));
return $schema;
}
示例6: isDestinationFieldCompatible
/**
* Check if a field on the entity type to update is a possible destination field.
*
* @todo Should this be on our FieldManager service?
*
* @param \Drupal\Core\Field\FieldStorageDefinitionInterface $definition
* Field definition on entity type to update to check.
* @param \Drupal\Core\Field\FieldDefinitionInterface $source_field
* Source field to check compatibility against. If none then check generally.
*
* @return bool
*/
protected function isDestinationFieldCompatible(FieldStorageDefinitionInterface $definition, FieldDefinitionInterface $source_field = NULL)
{
// @todo Create field definition wrapper class to treat FieldDefinitionInterface and FieldStorageDefinitionInterface the same.
if ($definition instanceof BaseFieldDefinition && $definition->isReadOnly()) {
return FALSE;
}
// Don't allow updates on updates!
if ($definition->getType() == 'entity_reference') {
if ($definition->getSetting('target_type') == 'scheduled_update') {
return FALSE;
}
}
if ($source_field) {
$matching_types = $this->getMatchingFieldTypes($source_field->getType());
if (!in_array($definition->getType(), $matching_types)) {
return FALSE;
}
// Check cardinality
$destination_cardinality = $definition->getCardinality();
$source_cardinality = $source_field->getFieldStorageDefinition()->getCardinality();
// $destination_cardinality is unlimited. It doesn't matter what source is.
if ($destination_cardinality != -1) {
if ($source_cardinality == -1) {
return FALSE;
}
if ($source_cardinality > $destination_cardinality) {
return FALSE;
}
}
switch ($definition->getType()) {
case 'entity_reference':
// Entity reference field must match entity target types.
if ($definition->getSetting('target_type') != $source_field->getSetting('target_type')) {
return FALSE;
}
// @todo Check bundles
break;
// @todo Other type specific conditions?
}
}
return TRUE;
}
示例7: schema
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition)
{
return array('columns' => array('value' => array('type' => 'int', 'not null' => FALSE, 'unsigned' => $field_definition->getSetting('unsigned'), 'size' => $field_definition->getSetting('size'))));
}
示例8: schema
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition)
{
return array('columns' => array('value' => array('type' => 'varchar', 'length' => $field_definition->getSetting('max_length')), 'format' => array('type' => 'varchar', 'length' => 255)), 'indexes' => array('format' => array('format')));
}
示例9: schema
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition)
{
return array('columns' => array('value' => array('type' => 'varchar', 'length' => (int) $field_definition->getSetting('max_length'), 'binary' => $field_definition->getSetting('case_sensitive'))));
}
示例10: schema
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition)
{
return array('columns' => array('value' => array('type' => 'numeric', 'precision' => $field_definition->getSetting('precision'), 'scale' => $field_definition->getSetting('scale'))));
}
示例11: schema
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition)
{
$target_type = $field_definition->getSetting('target_type');
$target_type_info = \Drupal::entityTypeManager()->getDefinition($target_type);
$schema = parent::schema($field_definition);
if ($target_type_info->getKey('revision')) {
$schema['columns']['target_revision_id'] = array('description' => 'The revision ID of the target entity.', 'type' => 'int', 'unsigned' => TRUE);
$schema['indexes']['target_revision_id'] = array('target_revision_id');
}
return $schema;
}
示例12: schema
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition)
{
return array('columns' => array('value' => array('type' => $field_definition->getSetting('case_sensitive') ? 'blob' : 'text', 'size' => 'big')));
}
示例13: schema
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition)
{
return array('columns' => array('value' => array('type' => 'varchar', 'length' => (int) $field_definition->getSetting('max_length'), 'not null' => FALSE)));
}
示例14: schema
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition)
{
$maxlenght = $field_definition->getSetting('maxlength');
return array('columns' => array('value' => array('type' => 'varchar', 'length' => $maxlenght, 'not null' => FALSE)), 'indexes' => array('value' => array('value')));
}
示例15: getColumnSpecification
/**
* {@inheritdoc}
*/
protected static function getColumnSpecification(FieldStorageDefinitionInterface $field_definition)
{
return array('type' => 'numeric', 'precision' => $field_definition->getSetting('precision'), 'scale' => $field_definition->getSetting('scale'));
}