YoastSeoItem.php in Real-time SEO for Drupal 8
File
src/Plugin/Field/FieldType/YoastSeoItem.php
View source
<?php
namespace Drupal\yoast_seo\Plugin\Field\FieldType;
use Drupal\Core\Field\FieldItemBase;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\TypedData\DataDefinition;
class YoastSeoItem extends FieldItemBase {
public static function mainPropertyName() {
return 'status';
}
public static function schema(FieldStorageDefinitionInterface $field_definition) {
return [
'columns' => [
'status' => [
'type' => 'varchar',
'length' => 256,
'not null' => FALSE,
],
'focus_keyword' => [
'type' => 'varchar',
'length' => 256,
'not null' => FALSE,
],
],
];
}
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['status'] = DataDefinition::create('string')
->setLabel(t('Status'));
$properties['focus_keyword'] = DataDefinition::create('string')
->setLabel(t('Focus Keyword'));
return $properties;
}
}
Classes
Name |
Description |
YoastSeoItem |
Plugin implementation of the 'yoast_seo' field type. |