field_test.field.inc

Same filename in other branches
  1. 7.x modules/field/tests/field_test.field.inc
  2. 9 core/modules/field/tests/modules/field_test/field_test.field.inc
  3. 8.9.x core/modules/field/tests/modules/field_test/field_test.field.inc
  4. 10 core/modules/field/tests/modules/field_test/field_test.field.inc

File

core/modules/field/tests/modules/field_test/field_test.field.inc

View source
<?php


/**
 * @file
 * Defines a field type and its formatters and widgets.
 */
declare (strict_types=1);
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Field\FieldDefinitionInterface;

/**
 * Sample 'default value' callback.
 */
function field_test_default_value(FieldableEntityInterface $entity, FieldDefinitionInterface $definition) {
    return [
        [
            'value' => 99,
        ],
    ];
}

Functions

Title Deprecated Summary
field_test_default_value Sample 'default value' callback.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.