ComputedStringLongItem.php in Computed Field 8.2
File
src/Plugin/Field/FieldType/ComputedStringLongItem.php
View source
<?php
namespace Drupal\computed_field\Plugin\Field\FieldType;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Form\FormStateInterface;
class ComputedStringLongItem extends ComputedStringItemBase {
public static function schema(FieldStorageDefinitionInterface $field_definition) {
$settings = $field_definition
->getSettings();
$schema = [
'columns' => [
'value' => [
'type' => $settings['case_sensitive'] ? 'blob' : 'text',
'size' => 'big',
],
],
];
return $schema;
}
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
$values['value'] = '';
return $values;
}
public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
$element = parent::fieldSettingsForm($form, $form_state);
$element['code']['#title'] = $this
->t('Code (PHP) to compute the <em>long text</em> value');
return $element;
}
}