diff core/modules/user/src/StatusItem.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/user/src/StatusItem.php	Mon Apr 23 09:46:53 2018 +0100
@@ -0,0 +1,25 @@
+<?php
+
+namespace Drupal\user;
+
+use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Field\Plugin\Field\FieldType\BooleanItem;
+
+/**
+ * Defines the 'status' entity field type.
+ *
+ * @todo Consider making this a full field type plugin in
+ *   https://www.drupal.org/project/drupal/issues/2936864.
+ */
+class StatusItem extends BooleanItem {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
+    // Always generate a sample with an enabled status.
+    $values['value'] = 1;
+    return $values;
+  }
+
+}