You are here

EnabledPluginTrait.php in Markdown 8.2

File

src/Traits/EnabledPluginTrait.php
View source
<?php

namespace Drupal\markdown\Traits;


/**
 * Trait for adding an "enabled" state to plugins.
 *
 * @todo Move upstream to https://www.drupal.org/project/installable_plugins.
 */
trait EnabledPluginTrait {

  /**
   * {@inheritdoc}
   */
  public function enabledByDefault() {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function isEnabled() {
    $enabled = $this->config
      ->get('enabled');
    return isset($enabled) ? !!$enabled : $this
      ->enabledByDefault();
  }

}

Traits

Namesort descending Description
EnabledPluginTrait Trait for adding an "enabled" state to plugins.