StatusItem.php 580 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace Drupal\user;
  3. use Drupal\Core\Field\FieldDefinitionInterface;
  4. use Drupal\Core\Field\Plugin\Field\FieldType\BooleanItem;
  5. /**
  6. * Defines the 'status' entity field type.
  7. *
  8. * @todo Consider making this a full field type plugin in
  9. * https://www.drupal.org/project/drupal/issues/2936864.
  10. */
  11. class StatusItem extends BooleanItem {
  12. /**
  13. * {@inheritdoc}
  14. */
  15. public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
  16. // Always generate a sample with an enabled status.
  17. $values['value'] = 1;
  18. return $values;
  19. }
  20. }