class LinkTestBaseFieldHooks

Hook implementations for link_test_base_field.

Hierarchy

Expanded class hierarchy of LinkTestBaseFieldHooks

File

core/modules/link/tests/modules/link_test_base_field/src/Hook/LinkTestBaseFieldHooks.php, line 16

Namespace

Drupal\link_test_base_field\Hook
View source
class LinkTestBaseFieldHooks {
    
    /**
     * Implements hook_entity_base_field_info().
     */
    public function entityBaseFieldInfo(EntityTypeInterface $entity_type) {
        $fields = [];
        if ($entity_type->id() === 'entity_test') {
            $fields['links'] = BaseFieldDefinition::create('link')->setLabel(t('Links'))
                ->setRevisionable(TRUE)
                ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
                ->setDescription(t('Add links to the entity.'))
                ->setRequired(FALSE)
                ->setSettings([
                'link_type' => LinkItemInterface::LINK_GENERIC,
                'title' => DRUPAL_REQUIRED,
            ])
                ->setDisplayOptions('form', [
                'type' => 'link_default',
                'weight' => 49,
            ]);
        }
        return $fields;
    }

}

Members

Title Sort descending Modifiers Object type Summary
LinkTestBaseFieldHooks::entityBaseFieldInfo public function Implements hook_entity_base_field_info().

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