Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

All configuration entities can now be disabled/enabled and asked for it's status.

Status implementations for configuration entities should follow these general rules:

  • Status does not affect the loading of entities. I.e. Disabling configuration entities should only have UI/access implications.
  • It should only take effect when a 'status' key is explicitly declared in the entity_keys info of a configuration entitys annotation data.
  • Each entity implementation (entity/controller) is responsible for checking and managing the status.

Steps needed to implement this:

...
 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "label",
 *     "status" = "status"
 *   }
...

Set a 'status' key in entity_keys on the config entity annotation info.

Example API usage:

$entity = ConfigTest::load('test');

// Disable the entity.
$entity->disable()->save();
// Enable the entity.
$entity->enable()->save();

// Ask for the current status. This will be TRUE or FALSE.
$entity->status();

// The status can also be set directly without the enable/disable wrappers.
// Disable the entity.
$entity->setStatus(FALSE)->save();
// Enable the entity.
$entity->setStatus(TRUE)->save();
Impacts: 
Module developers