CmisField.php in CMIS API 3.0.x
File
src/Plugin/Field/FieldType/CmisField.php
View source
<?php
declare (strict_types=1);
namespace Drupal\cmis\Plugin\Field\FieldType;
use Drupal\Core\Field\FieldItemBase;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\TypedData\DataDefinition;
class CmisField extends FieldItemBase {
public static function schema(FieldStorageDefinitionInterface $field_definition) {
return [
'columns' => [
'title' => [
'type' => 'varchar',
'length' => 255,
],
'path' => [
'type' => 'varchar',
'length' => 255,
],
],
];
}
public function isEmpty() {
$value1 = $this
->get('title')
->getValue();
$value2 = $this
->get('path')
->getValue();
return empty($value1) && empty($value2);
}
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['title'] = DataDefinition::create('string')
->setLabel(t('Title'))
->setDescription(t('The title of CMIS object.'));
$properties['path'] = DataDefinition::create('string')
->setLabel(t('Path'))
->setDescription(t('The path of CMIS object.'));
return $properties;
}
}
Classes
Name |
Description |
CmisField |
Plugin implementation of the 'cmis_field' field type. |