You are here

function paragraph_blocks_entity_base_field_info in Paragraph blocks 8

Same name and namespace in other branches
  1. 8.2 paragraph_blocks.module \paragraph_blocks_entity_base_field_info()
  2. 3.x paragraph_blocks.module \paragraph_blocks_entity_base_field_info()

Implements hook_entity_base_field_info().

File

./paragraph_blocks.module, line 35
Contains paragraph_blocks.module.

Code

function paragraph_blocks_entity_base_field_info(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->id() == 'paragraph') {
    $fields = [];
    $fields['admin_title'] = BaseFieldDefinition::create('string')
      ->setLabel(t('Admin title'))
      ->setDescription(t('The admin title is used to help place paragraphs into panes.'))
      ->setTranslatable(TRUE)
      ->setDisplayOptions('form', [
      'type' => 'string_textfield',
      'weight' => -10,
    ])
      ->setDisplayConfigurable('form', TRUE);
    return $fields;
  }
}