You are here

abstract class ContentTypeBase in Opigno group manager 8

Same name and namespace in other branches
  1. 3.x src/ContentTypeBase.php \Drupal\opigno_group_manager\ContentTypeBase

Class ContentTypeBase.

@package Drupal\opigno_group_manager

This class contains the basics that every plugin implementation of Learning Path Content Type should extend from.

Hierarchy

Expanded class hierarchy of ContentTypeBase

File

src/ContentTypeBase.php, line 15

Namespace

Drupal\opigno_group_manager
View source
abstract class ContentTypeBase extends PluginBase implements ContentTypeInterface {

  /**
   * Returns entity type.
   *
   * @return string
   *   Entity type.
   */
  public function getEntityType() {
    return $this->pluginDefinition['entity_type'];
  }

  /**
   * Returns ID.
   *
   * @return string
   *   ID.
   */
  public function getId() {
    return $this->pluginDefinition['id'];
  }

  /**
   * Returns readable name.
   *
   * @return string
   *   Readable name.
   */
  public function getReadableName() {
    return $this->pluginDefinition['readable_name'];
  }

  /**
   * Returns description.
   *
   * @return string
   *   Description.
   */
  public function getDescription() {
    return $this->pluginDefinition['description'];
  }

  /**
   * Returns allowed group types.
   *
   * @return string
   *   Allowed group types.
   */
  public function getAllowedGroupTypes() {
    return $this->pluginDefinition['allowed_group_types'];
  }

  /**
   * Returns plugin id.
   *
   * @return string
   *   Plugin id.
   */
  public function getGroupContentPluginId() {
    return $this->pluginDefinition['group_content_plugin_id'];
  }

  /**
   * Get the URL object for starting the quiz.
   *
   * @param int $content_id
   *   The content ID (ex: node ID).
   * @param int $group_id
   *   The group ID (optional).
   *
   * @return \Drupal\Core\Url
   *   The URL to use to start the "test" for a student.
   */
  public function getStartContentUrl($content_id, $group_id = NULL) {
    return $this
      ->getViewContentUrl($content_id);
  }

  /**
   * Answer if the current page should show the "finish" button.
   *
   * By default, it returns the value from shouldShowNext().
   *
   * @return bool
   *   TRUE if the page should show the "finish" button. FALSE otherwise.
   */
  public function shouldShowFinish() {
    return $this
      ->shouldShowNext();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContentTypeBase::getAllowedGroupTypes public function Returns allowed group types.
ContentTypeBase::getDescription public function Returns description.
ContentTypeBase::getEntityType public function Returns entity type.
ContentTypeBase::getGroupContentPluginId public function Returns plugin id.
ContentTypeBase::getId public function Returns ID.
ContentTypeBase::getReadableName public function Returns readable name.
ContentTypeBase::getStartContentUrl public function Get the URL object for starting the quiz.
ContentTypeBase::shouldShowFinish public function Answer if the current page should show the "finish" button.
ContentTypeInterface::getAllContents public function Get all the entities in an array of LearningPathContent.
ContentTypeInterface::getAvailableContents public function Get all the published entities in an array of LearningPathContent.
ContentTypeInterface::getContent public function Get the entity as a LearningPathContent.
ContentTypeInterface::getContentFromRequest public function Try to get the content from a Request object.
ContentTypeInterface::getFormObject public function Get the form object based on the entity ID.
ContentTypeInterface::getUserScore public function Get the score of the user for a specific entity.
ContentTypeInterface::getViewContentUrl public function Get the URL object of the main view page of a specific entity.
ContentTypeInterface::shouldShowNext public function Return TRUE if the page should show the "next" action button.
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 1
DependencySerializationTrait::__wakeup public function 2
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. 92
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.