StatusItem.php

Same filename and directory in other branches
  1. 9 core/modules/user/src/StatusItem.php
  2. 10 core/modules/user/src/StatusItem.php
  3. 11.x core/modules/user/src/StatusItem.php

Namespace

Drupal\user

File

core/modules/user/src/StatusItem.php

View source
<?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;
    }

}

Classes

Title Deprecated Summary
StatusItem Defines the 'status' entity field type.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.