You are here

class Flag in Flag 8.4

Provides the Flag configuration entity.

Plugin annotation


@ConfigEntityType(
  id = "flag",
  label = @Translation("Flag"),
  label_singular = @Translation("flag"),
  label_plural = @Translation("flags"),
  label_count = @PluralTranslation(
    singular = "@count flag",
    plural = "@count flags",
  ),
  admin_permission = "administer flags",
  handlers = {
    "list_builder" = "Drupal\flag\Controller\FlagListBuilder",
    "form" = {
      "add" = "Drupal\flag\Form\FlagAddForm",
      "edit" = "Drupal\flag\Form\FlagEditForm",
      "delete" = "Drupal\Core\Entity\EntityDeleteForm"
    }
  },
  bundle_of = "flagging",
  entity_keys = {
    "id" = "id",
    "label" = "label",
    "weight" = "weight",
  },
  config_export = {
    "id",
    "uuid",
    "label",
    "bundles",
    "entity_type",
    "global",
    "weight",
    "flag_short",
    "flag_long",
    "flag_message",
    "unflag_short",
    "unflag_long",
    "unflag_message",
    "unflag_denied_text",
    "flag_type",
    "link_type",
    "flagTypeConfig",
    "linkTypeConfig",
  },
  lookup_keys = {
    "global",
  },
  links = {
    "edit-form" = "/admin/structure/flags/manage/{flag}",
    "delete-form" = "/admin/structure/flags/manage/{flag}/delete",
    "collection" = "/admin/structure/flags",
    "enable" = "/admin/structure/flags/manage/{flag}/enable",
    "disable" = "/admin/structure/flags/manage/{flag}/disable",
    "reset" = "/admin/structure/flags/manage/{flag}/reset"
  }
)

Hierarchy

Expanded class hierarchy of Flag

11 files declare their use of Flag
AccessTest.php in tests/src/Kernel/AccessTest.php
AnonymousFlagTest.php in tests/src/Functional/AnonymousFlagTest.php
FlagActionTest.php in tests/src/Kernel/FlagActionTest.php
FlagBookmarkInstallUninstallTest.php in modules/flag_bookmark/tests/src/Kernel/FlagBookmarkInstallUninstallTest.php
FlagContextualLinksTest.php in tests/src/FunctionalJavascript/FlagContextualLinksTest.php

... See full list

5 string references to 'Flag'
flag.info.yml in ./flag.info.yml
flag.info.yml
flag.schema.yml in config/schema/flag.schema.yml
config/schema/flag.schema.yml
FlagListBuilder::buildHeader in src/Controller/FlagListBuilder.php
Builds the header row for the entity listing.
FlagViewsRelationship::buildOptionsForm in src/Plugin/views/relationship/FlagViewsRelationship.php
Provide a form to edit options for this plugin.
flag_views_data_alter in ./flag.views.inc
Implements hook_views_data_alter().

File

src/Entity/Flag.php, line 73

Namespace

Drupal\flag\Entity
View source
class Flag extends ConfigEntityBundleBase implements FlagInterface {

  // @todo: Define flag reset method.

  /**
   * The entity type this flag works with.
   *
   * @var string
   */
  protected $entity_type = NULL;

  /**
   * Whether this flag state should act as a single toggle to all users.
   *
   * @var bool
   */
  protected $global = FALSE;

  /**
   * The bundles this flag applies to.
   *
   * This may be an empty array to indicate all bundles apply.
   *
   * @var array
   */
  protected $bundles = [];

  /**
   * The text for the "flag this" link for this flag.
   *
   * @var string
   */
  protected $flag_short = '';

  /**
   * The description of the "flag this" link.
   *
   * @var string
   */
  protected $flag_long = '';

  /**
   * Message displayed after flagging an entity.
   *
   * @var string
   */
  protected $flag_message = '';

  /**
   * The text for the "unflag this" link for this flag.
   *
   * @var string
   */
  protected $unflag_short = '';

  /**
   * The description of the "unflag this" link.
   *
   * @var string
   */
  protected $unflag_long = '';

  /**
   * Message displayed after flagging an entity.
   *
   * @var string
   */
  protected $unflag_message = '';

  /**
   * Message displayed if users aren't allowed to unflag.
   *
   * @var string
   */
  protected $unflag_denied_text = '';

  /**
   * The ID of the FlagType plugin.
   *
   * @var string
   */
  protected $flag_type;

  /**
   * A collection to store the FlagType plugin.
   *
   * @var \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection
   */
  protected $flagTypeCollection;

  /**
   * An array to store and load the FlagType plugin configuration.
   *
   * @var array
   */
  protected $flagTypeConfig = [];

  /**
   * The ID of the ActionLink plugin.
   *
   * @var string
   * @see \Drupal\flag\ActionLink\ActionLinkTypeBase
   */
  protected $link_type = 'reload';

  /**
   * A collection to store the ActionLink plugin.
   *
   * @var \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection
   */
  protected $linkTypeCollection;

  /**
   * An array to store and load the ActionLink plugin configuration.
   *
   * @var array
   */
  protected $linkTypeConfig = [];

  /**
   * The weight of the flag.
   *
   * @var int
   */
  protected $weight = 0;

  /**
   * {@inheritdoc}
   */
  public function isFlagged(EntityInterface $entity, AccountInterface $account = NULL, $session_id = NULL) {
    \Drupal::service('flag')
      ->populateFlaggerDefaults($account, $session_id);

    // Load the is flagged list from the flagging storage, check if this flag
    // is in the list.
    $flag_ids = \Drupal::entityTypeManager()
      ->getStorage('flagging')
      ->loadIsFlagged($entity, $account, $session_id);
    return isset($flag_ids[$this
      ->id()]);
  }

  /**
   * {@inheritdoc}
   */
  public function getFlaggableEntityTypeId() {
    return $this->entity_type;
  }

  /**
   * {@inheritdoc}
   */
  public function getBundles() {
    return $this->bundles;
  }

  /**
   * {@inheritdoc}
   */
  public function getApplicableBundles() {
    $bundles = $this
      ->getBundles();
    if (empty($bundles)) {

      // If the setting is empty, return all bundle names for the flag's entity
      // type.

      /** @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface $bundle_info_service */
      $bundle_info_service = \Drupal::service('entity_type.bundle.info');
      $bundle_info = $bundle_info_service
        ->getBundleInfo($this->entity_type);
      $bundles = array_keys($bundle_info);
    }
    return $bundles;
  }

  /**
   * {@inheritdoc}
   */
  public function getPluginCollections() {
    return [
      'flagTypeConfig' => $this
        ->getFlagTypeCollection(),
      'linkTypeConfig' => $this
        ->getLinkTypeCollection(),
    ];
  }

  /**
   * Encapsulates the creation of the flag type's plugin collection.
   *
   * @return \Drupal\Component\Plugin\DefaultSingleLazyPluginCollection
   *   The flag type's plugin collection.
   */
  protected function getFlagTypeCollection() {
    if (!$this->flagTypeCollection) {
      $this->flagTypeCollection = new DefaultSingleLazyPluginCollection(\Drupal::service('plugin.manager.flag.flagtype'), $this->flag_type, $this->flagTypeConfig);
    }
    return $this->flagTypeCollection;
  }

  /**
   * {@inheritdoc}
   */
  public function getFlagTypePlugin() {
    return $this
      ->getFlagTypeCollection()
      ->get($this->flag_type);
  }

  /**
   * {@inheritdoc}
   */
  public function setFlagTypePlugin($plugin_id) {
    $this->flag_type = $plugin_id;

    // $this->flagTypeBag->addInstanceId($pluginID);
    // Workaround for https://www.drupal.org/node/2288805
    $this->flagTypeCollection = new DefaultSingleLazyPluginCollection(\Drupal::service('plugin.manager.flag.flagtype'), $this->flag_type, $this->flagTypeConfig);

    // Get the entity type from the plugin definition.
    $plugin = $this
      ->getFlagTypePlugin();
    $plugin_def = $plugin
      ->getPluginDefinition();
    $this->entity_type = $plugin_def['entity_type'];
  }

  /**
   * {@inheritdoc}
   */
  public function getLinkTypePlugin() {
    return $this
      ->getLinkTypeCollection()
      ->get($this->link_type);
  }

  /**
   * Encapsulates the creation of the link type's plugin collection.
   *
   * @return \Drupal\Component\Plugin\DefaultSingleLazyPluginCollection
   *   The link type's plugin collection.
   */
  protected function getLinkTypeCollection() {
    if (!$this->linkTypeCollection) {
      $this->linkTypeCollection = new DefaultSingleLazyPluginCollection(\Drupal::service('plugin.manager.flag.linktype'), $this->link_type, $this->linkTypeConfig);
    }
    return $this->linkTypeCollection;
  }

  /**
   * {@inheritdoc}
   */
  public function setlinkTypePlugin($plugin_id) {
    $this->link_type = $plugin_id;

    // $this->linkTypeBag->addInstanceId($pluginID);
    // Workaround for https://www.drupal.org/node/2288805
    $this->linkTypeCollection = new DefaultSingleLazyPluginCollection(\Drupal::service('plugin.manager.flag.linktype'), $this->link_type, $this->linkTypeConfig);
  }

  /**
   * {@inheritdoc}
   */
  public function actionPermissions() {
    return $this
      ->getFlagTypePlugin()
      ->actionPermissions($this);
  }

  /**
   * {@inheritdoc}
   */
  public function actionAccess($action, AccountInterface $account = NULL, EntityInterface $flaggable = NULL) {
    $account = $account ?: \Drupal::currentUser();
    return $this
      ->getFlagTypePlugin()
      ->actionAccess($action, $this, $account, $flaggable);
  }

  /**
   * {@inheritdoc}
   */
  public function isGlobal() {
    return $this->global;
  }

  /**
   * {@inheritdoc}
   */
  public function setGlobal($global = TRUE) {
    if ($global) {
      $this->global = TRUE;
    }
    else {
      $this->global = FALSE;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function setFlagShortText($text) {
    $this->flag_short = $text;
  }

  /**
   * {@inheritdoc}
   */
  public function getShortText($action) {
    return $action === 'unflag' ? $this->unflag_short : $this->flag_short;
  }

  /**
   * {@inheritdoc}
   */
  public function getLongText($action) {
    return $action === 'unflag' ? $this->unflag_long : $this->flag_long;
  }

  /**
   * {@inheritdoc}
   */
  public function setFlagLongText($flag_long) {
    $this->flag_long = $flag_long;
  }

  /**
   * {@inheritdoc}
   */
  public function getMessage($action) {
    return $action === 'unflag' ? $this->unflag_message : $this->flag_message;
  }

  /**
   * {@inheritdoc}
   */
  public function setFlagMessage($flag_message) {
    $this->flag_message = $flag_message;
  }

  /**
   * {@inheritdoc}
   */
  public function setUnflagLongText($unflag_long) {
    $this->unflag_long = $unflag_long;
  }

  /**
   * {@inheritdoc}
   */
  public function setUnflagMessage($unflag_message) {
    $this->unflag_message = $unflag_message;
  }

  /**
   * {@inheritdoc}
   */
  public function setUnflagShortText($unflag_short) {
    $this->unflag_short = $unflag_short;
  }

  /**
   * {@inheritdoc}
   */
  public function getUnflagDeniedText() {
    return $this->unflag_denied_text;
  }

  /**
   * {@inheritdoc}
   */
  public function setUnflagDeniedText($unflag_denied_text) {
    $this->unflag_denied_text = $unflag_denied_text;
  }

  /**
   * {@inheritdoc}
   */
  public function getWeight() {
    return $this->weight;
  }

  /**
   * {@inheritdoc}
   */
  public function setWeight($weight) {
    $this->weight = $weight;
  }

  /**
   * {@inheritdoc}
   */
  public function preSave(EntityStorageInterface $storage) {
    parent::preSave($storage);
    $bundles = array_filter($this
      ->get('bundles'));
    sort($bundles);
    $this
      ->set('bundles', $bundles);

    /*
    // Save the Flag Type configuration.
    $flagTypePlugin = $this->getFlagTypePlugin();
    $this->set('flagTypeConfig', $flagTypePlugin->getConfiguration());

    // Save the Link Type configuration.
    $linkTypePlugin = $this->getLinkTypePlugin();
    $this->set('linkTypeConfig', $linkTypePlugin->getConfiguration());
    */

    // Reset the render cache for the entity.
    \Drupal::entityTypeManager()
      ->getViewBuilder($this
      ->getFlaggableEntityTypeId())
      ->resetCache();

    // Clear entity extra field caches.
    // @todo Inject the entity field manager into the object?
    \Drupal::service('entity_field.manager')
      ->clearCachedFieldDefinitions();
  }

  /**
   * {@inheritdoc}
   */
  public static function preDelete(EntityStorageInterface $storage, array $entities) {
    parent::preDelete($storage, $entities);
    foreach ($entities as $flag) {
      \Drupal::service('flag')
        ->unflagAllByFlag($flag);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    parent::postSave($storage, $update);
    if (\Drupal::moduleHandler()
      ->moduleExists('views')) {

      // Rebuild views data to invalidate flag relationships.
      \Drupal::service('views.views_data')
        ->clear();
    }
    \Drupal::service('plugin.manager.action')
      ->clearCachedDefinitions();
  }

  /**
   * {@inheritdoc}
   */
  public static function postDelete(EntityStorageInterface $storage, array $entities) {
    parent::postDelete($storage, $entities);
    if (\Drupal::moduleHandler()
      ->moduleExists('views')) {

      // Rebuild views data to invalidate flag relationships.
      \Drupal::service('views.views_data')
        ->clear();
    }
    \Drupal::service('plugin.manager.action')
      ->clearCachedDefinitions();
  }

  /**
   * Sorts the flag entities, putting disabled flags at the bottom.
   *
   * @see \Drupal\Core\Config\Entity\ConfigEntityBase::sort()
   */
  public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {

    // Check if the entities are flags, if not go with the default.
    if ($a instanceof FlagInterface && $b instanceof FlagInterface) {
      if ($a
        ->status() && $b
        ->status()) {
        return parent::sort($a, $b);
      }
      elseif (!$a
        ->status()) {
        return -1;
      }
      elseif (!$b
        ->status()) {
        return 1;
      }
    }
    return parent::sort($a, $b);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
ConfigEntityBase::$isUninstalling private property Whether the config is being deleted by the uninstall process.
ConfigEntityBase::$langcode protected property The language code of the entity's default language.
ConfigEntityBase::$originalId protected property The original ID of the configuration entity.
ConfigEntityBase::$status protected property The enabled/disabled status of the configuration entity. 4
ConfigEntityBase::$third_party_settings protected property Third party entity settings.
ConfigEntityBase::$trustedData protected property Trust supplied data and not use configuration schema on save.
ConfigEntityBase::$uuid protected property The UUID for this entity.
ConfigEntityBase::$_core protected property Information maintained by Drupal core about configuration.
ConfigEntityBase::addDependency protected function Overrides \Drupal\Core\Entity\DependencyTrait:addDependency().
ConfigEntityBase::calculateDependencies public function Calculates dependencies and stores them in the dependency property. Overrides ConfigEntityInterface::calculateDependencies 13
ConfigEntityBase::createDuplicate public function Creates a duplicate of the entity. Overrides EntityBase::createDuplicate 1
ConfigEntityBase::disable public function Disables the configuration entity. Overrides ConfigEntityInterface::disable 1
ConfigEntityBase::enable public function Enables the configuration entity. Overrides ConfigEntityInterface::enable
ConfigEntityBase::get public function Returns the value of a property. Overrides ConfigEntityInterface::get
ConfigEntityBase::getCacheTagsToInvalidate public function Returns the cache tags that should be used to invalidate caches. Overrides EntityBase::getCacheTagsToInvalidate 1
ConfigEntityBase::getConfigDependencyName public function Gets the configuration dependency name. Overrides EntityBase::getConfigDependencyName
ConfigEntityBase::getConfigManager protected static function Gets the configuration manager.
ConfigEntityBase::getConfigTarget public function Gets the configuration target identifier for the entity. Overrides EntityBase::getConfigTarget
ConfigEntityBase::getDependencies public function Gets the configuration dependencies. Overrides ConfigEntityInterface::getDependencies
ConfigEntityBase::getOriginalId public function Gets the original ID. Overrides EntityBase::getOriginalId
ConfigEntityBase::getThirdPartyProviders public function Gets the list of third parties that store information. Overrides ThirdPartySettingsInterface::getThirdPartyProviders
ConfigEntityBase::getThirdPartySetting public function Gets the value of a third-party setting. Overrides ThirdPartySettingsInterface::getThirdPartySetting
ConfigEntityBase::getThirdPartySettings public function Gets all third-party settings of a given module. Overrides ThirdPartySettingsInterface::getThirdPartySettings
ConfigEntityBase::getTypedConfig protected function Gets the typed config manager.
ConfigEntityBase::hasTrustedData public function Gets whether on not the data is trusted. Overrides ConfigEntityInterface::hasTrustedData
ConfigEntityBase::invalidateTagsOnDelete protected static function Override to never invalidate the individual entities' cache tags; the config system already invalidates them. Overrides EntityBase::invalidateTagsOnDelete
ConfigEntityBase::invalidateTagsOnSave protected function Override to never invalidate the entity's cache tag; the config system already invalidates it. Overrides EntityBase::invalidateTagsOnSave
ConfigEntityBase::isInstallable public function Checks whether this entity is installable. Overrides ConfigEntityInterface::isInstallable 2
ConfigEntityBase::isNew public function Overrides Entity::isNew(). Overrides EntityBase::isNew
ConfigEntityBase::isUninstalling public function Returns whether this entity is being changed during the uninstall process. Overrides ConfigEntityInterface::isUninstalling
ConfigEntityBase::link public function Deprecated way of generating a link to the entity. See toLink(). Overrides EntityBase::link
ConfigEntityBase::onDependencyRemoval public function Informs the entity that entities it depends on will be deleted. Overrides ConfigEntityInterface::onDependencyRemoval 7
ConfigEntityBase::save public function Saves an entity permanently. Overrides EntityBase::save 1
ConfigEntityBase::set public function Sets the value of a property. Overrides ConfigEntityInterface::set
ConfigEntityBase::setOriginalId public function Sets the original ID. Overrides EntityBase::setOriginalId
ConfigEntityBase::setStatus public function Sets the status of the configuration entity. Overrides ConfigEntityInterface::setStatus
ConfigEntityBase::setThirdPartySetting public function Sets the value of a third-party setting. Overrides ThirdPartySettingsInterface::setThirdPartySetting
ConfigEntityBase::setUninstalling public function
ConfigEntityBase::status public function Returns whether the configuration entity is enabled. Overrides ConfigEntityInterface::status 4
ConfigEntityBase::toArray public function Gets an array of all property values. Overrides EntityBase::toArray 2
ConfigEntityBase::toUrl public function Gets the URL object for the entity. Overrides EntityBase::toUrl
ConfigEntityBase::trustData public function Sets that the data should be trusted. Overrides ConfigEntityInterface::trustData
ConfigEntityBase::unsetThirdPartySetting public function Unsets a third-party setting. Overrides ThirdPartySettingsInterface::unsetThirdPartySetting
ConfigEntityBase::url public function Gets the public URL for this entity. Overrides EntityBase::url
ConfigEntityBase::urlInfo public function Gets the URL object for the entity. Overrides EntityBase::urlInfo
ConfigEntityBase::__construct public function Constructs an Entity object. Overrides EntityBase::__construct 10
ConfigEntityBase::__sleep public function Overrides EntityBase::__sleep 4
ConfigEntityBundleBase::deleteDisplays protected function Deletes display if a bundle is deleted.
ConfigEntityBundleBase::loadDisplays protected function Returns view or form displays for this bundle.
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function Aliased as: traitSleep 1
DependencySerializationTrait::__wakeup public function 2
DependencyTrait::$dependencies protected property The object's dependencies.
DependencyTrait::addDependencies protected function Adds multiple dependencies.
DependencyTrait::addDependency protected function Adds a dependency. Aliased as: addDependencyTrait
EntityBase::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
EntityBase::$entityTypeId protected property The entity type.
EntityBase::$typedData protected property A typed data object wrapping this entity.
EntityBase::access public function Checks data value access. Overrides AccessibleInterface::access 1
EntityBase::bundle public function Gets the bundle of the entity. Overrides EntityInterface::bundle 1
EntityBase::create public static function Constructs a new entity object, without permanently saving it. Overrides EntityInterface::create
EntityBase::delete public function Deletes an entity permanently. Overrides EntityInterface::delete 2
EntityBase::enforceIsNew public function Enforces an entity to be new. Overrides EntityInterface::enforceIsNew
EntityBase::entityManager Deprecated protected function Gets the entity manager.
EntityBase::entityTypeBundleInfo protected function Gets the entity type bundle info service.
EntityBase::entityTypeManager protected function Gets the entity type manager.
EntityBase::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyTrait::getCacheContexts
EntityBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyTrait::getCacheMaxAge
EntityBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyTrait::getCacheTags
EntityBase::getConfigDependencyKey public function Gets the key that is used to store configuration dependencies. Overrides EntityInterface::getConfigDependencyKey
EntityBase::getEntityType public function Gets the entity type definition. Overrides EntityInterface::getEntityType
EntityBase::getEntityTypeId public function Gets the ID of the type of the entity. Overrides EntityInterface::getEntityTypeId
EntityBase::getListCacheTagsToInvalidate protected function The list cache tags to invalidate for this entity.
EntityBase::getTypedData public function Gets a typed data object for this entity object. Overrides EntityInterface::getTypedData
EntityBase::hasLinkTemplate public function Indicates if a link template exists for a given key. Overrides EntityInterface::hasLinkTemplate
EntityBase::id public function Gets the identifier. Overrides EntityInterface::id 11
EntityBase::label public function Gets the label of the entity. Overrides EntityInterface::label 6
EntityBase::language public function Gets the language of the entity. Overrides EntityInterface::language 1
EntityBase::languageManager protected function Gets the language manager.
EntityBase::linkTemplates protected function Gets an array link templates. 1
EntityBase::load public static function Loads an entity. Overrides EntityInterface::load
EntityBase::loadMultiple public static function Loads one or more entities. Overrides EntityInterface::loadMultiple
EntityBase::postCreate public function Acts on a created entity before hooks are invoked. Overrides EntityInterface::postCreate 4
EntityBase::postLoad public static function Acts on loaded entities. Overrides EntityInterface::postLoad 2
EntityBase::preCreate public static function Changes the values of an entity before it is created. Overrides EntityInterface::preCreate 5
EntityBase::referencedEntities public function Gets a list of entities referenced by this entity. Overrides EntityInterface::referencedEntities 1
EntityBase::toLink public function Generates the HTML for a link to this entity. Overrides EntityInterface::toLink
EntityBase::uriRelationships public function Gets a list of URI relationships supported by this entity. Overrides EntityInterface::uriRelationships
EntityBase::urlRouteParameters protected function Gets an array of placeholders for this entity. 2
EntityBase::uuid public function Gets the entity UUID (Universally Unique Identifier). Overrides EntityInterface::uuid 1
EntityBase::uuidGenerator protected function Gets the UUID generator.
Flag::$bundles protected property The bundles this flag applies to.
Flag::$entity_type protected property The entity type this flag works with.
Flag::$flagTypeCollection protected property A collection to store the FlagType plugin.
Flag::$flagTypeConfig protected property An array to store and load the FlagType plugin configuration.
Flag::$flag_long protected property The description of the "flag this" link.
Flag::$flag_message protected property Message displayed after flagging an entity.
Flag::$flag_short protected property The text for the "flag this" link for this flag.
Flag::$flag_type protected property The ID of the FlagType plugin.
Flag::$global protected property Whether this flag state should act as a single toggle to all users.
Flag::$linkTypeCollection protected property A collection to store the ActionLink plugin.
Flag::$linkTypeConfig protected property An array to store and load the ActionLink plugin configuration.
Flag::$link_type protected property The ID of the ActionLink plugin.
Flag::$unflag_denied_text protected property Message displayed if users aren't allowed to unflag.
Flag::$unflag_long protected property The description of the "unflag this" link.
Flag::$unflag_message protected property Message displayed after flagging an entity.
Flag::$unflag_short protected property The text for the "unflag this" link for this flag.
Flag::$weight protected property The weight of the flag.
Flag::actionAccess public function Checks whether a user has permission to flag/unflag or not. Overrides FlagInterface::actionAccess
Flag::actionPermissions public function Returns an associative array of permissions used by flag_permission(). Overrides FlagInterface::actionPermissions
Flag::getApplicableBundles public function Get the bundles this flag may be applied to. Overrides FlagInterface::getApplicableBundles
Flag::getBundles public function Get the flag bundles property. Overrides FlagInterface::getBundles
Flag::getFlaggableEntityTypeId public function Returns the flaggable entity type ID. Overrides FlagInterface::getFlaggableEntityTypeId
Flag::getFlagTypeCollection protected function Encapsulates the creation of the flag type's plugin collection.
Flag::getFlagTypePlugin public function Get the flag type plugin. Overrides FlagInterface::getFlagTypePlugin
Flag::getLinkTypeCollection protected function Encapsulates the creation of the link type's plugin collection.
Flag::getLinkTypePlugin public function Get the link type plugin for this flag. Overrides FlagInterface::getLinkTypePlugin
Flag::getLongText public function Gets the flag long text. Overrides FlagInterface::getLongText
Flag::getMessage public function Gets the flag message. Overrides FlagInterface::getMessage
Flag::getPluginCollections public function Gets the plugin collections used by this object. Overrides ObjectWithPluginCollectionInterface::getPluginCollections
Flag::getShortText public function Gets the flag short text. Overrides FlagInterface::getShortText
Flag::getUnflagDeniedText public function Get the flag's unflag denied message text. Overrides FlagInterface::getUnflagDeniedText
Flag::getWeight public function Get the flag's weight. Overrides FlagInterface::getWeight
Flag::isFlagged public function Returns true of there's a flagging for this flag and the given entity. Overrides FlagInterface::isFlagged
Flag::isGlobal public function Returns true if the flag is global, false otherwise. Overrides FlagInterface::isGlobal
Flag::postDelete public static function Acts on deleted entities before the delete hook is invoked. Overrides ConfigEntityBundleBase::postDelete
Flag::postSave public function Acts on a saved entity before the insert or update hook is invoked. Overrides ConfigEntityBundleBase::postSave
Flag::preDelete public static function Acts on entities before they are deleted and before hooks are invoked. Overrides ConfigEntityBase::preDelete
Flag::preSave public function Acts on an entity before the presave hook is invoked. Overrides ConfigEntityBundleBase::preSave
Flag::setFlagLongText public function Sets the flag long text. Overrides FlagInterface::setFlagLongText
Flag::setFlagMessage public function Sets the flag message. Overrides FlagInterface::setFlagMessage
Flag::setFlagShortText public function The flag short text. Overrides FlagInterface::setFlagShortText
Flag::setFlagTypePlugin public function Set the flag type plugin. Overrides FlagInterface::setFlagTypePlugin
Flag::setGlobal public function Sets the flag as global or not. Overrides FlagInterface::setGlobal
Flag::setlinkTypePlugin public function Set the link type plugin. Overrides FlagInterface::setlinkTypePlugin
Flag::setUnflagDeniedText public function Set's the flag's unflag denied message text. Overrides FlagInterface::setUnflagDeniedText
Flag::setUnflagLongText public function Sets the unflag long text. Overrides FlagInterface::setUnflagLongText
Flag::setUnflagMessage public function Sets the unflag message. Overrides FlagInterface::setUnflagMessage
Flag::setUnflagShortText public function Sets the unflag short text. Overrides FlagInterface::setUnflagShortText
Flag::setWeight public function Set the flag's weight. Overrides FlagInterface::setWeight
Flag::sort public static function Sorts the flag entities, putting disabled flags at the bottom. Overrides ConfigEntityBase::sort
PluginDependencyTrait::calculatePluginDependencies protected function Calculates and adds dependencies of a specific plugin instance. 1
PluginDependencyTrait::getPluginDependencies protected function Calculates and returns dependencies of a specific plugin instance.
PluginDependencyTrait::moduleHandler protected function Wraps the module handler. 1
PluginDependencyTrait::themeHandler protected function Wraps the theme handler. 1
RefinableCacheableDependencyTrait::addCacheableDependency public function 1
RefinableCacheableDependencyTrait::addCacheContexts public function
RefinableCacheableDependencyTrait::addCacheTags public function
RefinableCacheableDependencyTrait::mergeCacheMaxAge public function
SynchronizableEntityTrait::$isSyncing protected property Whether this entity is being created, updated or deleted through a synchronization process.
SynchronizableEntityTrait::isSyncing public function
SynchronizableEntityTrait::setSyncing public function