Skip to content
Snippets Groups Projects
Commit 986d2973 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #1826602 follow-up by dawehner, tim.plunkett, sun: Follow-ups to allow...

Issue #1826602 follow-up by dawehner, tim.plunkett, sun: Follow-ups to allow all configuration entities to be enabled/disabled.
parent 5082019e
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ abstract class ConfigEntityBase extends Entity implements ConfigEntityInterface
*
* @var bool
*/
public $status;
public $status = TRUE;
/**
* Overrides Entity::__construct().
......
......@@ -62,6 +62,15 @@ public function setStatus($status);
/**
* Returns whether the configuration entity is enabled.
*
* 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.
*
* @return bool
*/
public function status();
......
......@@ -86,16 +86,22 @@ public function buildHeader() {
*/
public function getOperations(EntityInterface $view) {
$definition = parent::getOperations($view);
$uri = $view->uri();
$path = $uri['path'];
$definition['clone'] = array(
'title' => t('Clone'),
'href' => "$path/clone",
'href' => $uri['path'] . '/clone',
'options' => $uri['options'],
'weight' => 15,
);
// Add AJAX functionality to enable/disable operations.
foreach (array('enable', 'disable') as $op) {
if (isset($definition[$op])) {
$definition[$op]['ajax'] = TRUE;
}
}
return $definition;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment