0, ] + parent::defaultFieldSettings(); } /** * {@inheritdoc} */ public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) { $properties = parent::propertyDefinitions($field_definition); $properties['summary'] = DataDefinition::create('string') ->setLabel(t('Summary')); $properties['summary_processed'] = DataDefinition::create('string') ->setLabel(t('Processed summary')) ->setDescription(t('The summary text with the text format applied.')) ->setComputed(TRUE) ->setClass('\Drupal\text\TextProcessed') ->setSetting('text source', 'summary'); return $properties; } /** * {@inheritdoc} */ public static function schema(FieldStorageDefinitionInterface $field_definition) { return [ 'columns' => [ 'value' => [ 'type' => 'text', 'size' => 'big', ], 'summary' => [ 'type' => 'text', 'size' => 'big', ], 'format' => [ 'type' => 'varchar_ascii', 'length' => 255, ], ], 'indexes' => [ 'format' => ['format'], ], ]; } /** * {@inheritdoc} */ public function isEmpty() { $value = $this->get('summary')->getValue(); return parent::isEmpty() && ($value === NULL || $value === ''); } /** * {@inheritdoc} */ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { $element = []; $settings = $this->getSettings(); $element['display_summary'] = [ '#type' => 'checkbox', '#title' => t('Summary input'), '#default_value' => $settings['display_summary'], '#description' => t('This allows authors to input an explicit summary, to be displayed instead of the automatically trimmed text when using the "Summary or trimmed" display type.'), ]; return $element; } }