interface CommentStorageInterface
Same name in other branches
- 9 core/modules/comment/src/CommentStorageInterface.php \Drupal\comment\CommentStorageInterface
- 10 core/modules/comment/src/CommentStorageInterface.php \Drupal\comment\CommentStorageInterface
- 11.x core/modules/comment/src/CommentStorageInterface.php \Drupal\comment\CommentStorageInterface
Defines an interface for comment entity storage classes.
Hierarchy
- interface \Drupal\Core\Entity\EntityStorageInterface; interface \Drupal\Core\Entity\TranslatableRevisionableStorageInterface extends \Drupal\Core\Entity\TranslatableStorageInterface \Drupal\Core\Entity\RevisionableStorageInterface
- interface \Drupal\Core\Entity\ContentEntityStorageInterface extends \Drupal\Core\Entity\EntityStorageInterface \Drupal\Core\Entity\TranslatableRevisionableStorageInterface
- interface \Drupal\comment\CommentStorageInterface extends \Drupal\Core\Entity\ContentEntityStorageInterface
- interface \Drupal\Core\Entity\ContentEntityStorageInterface extends \Drupal\Core\Entity\EntityStorageInterface \Drupal\Core\Entity\TranslatableRevisionableStorageInterface
Expanded class hierarchy of CommentStorageInterface
All classes that implement CommentStorageInterface
1 file declares its use of CommentStorageInterface
- UnapprovedComments.php in core/
modules/ comment/ src/ Plugin/ Menu/ LocalTask/ UnapprovedComments.php
File
-
core/
modules/ comment/ src/ CommentStorageInterface.php, line 12
Namespace
Drupal\commentView source
interface CommentStorageInterface extends ContentEntityStorageInterface {
/**
* Gets the maximum encoded thread value for the top level comments.
*
* @param \Drupal\comment\CommentInterface $comment
* A comment entity.
*
* @return string
* The maximum encoded thread value among the top level comments of the
* node $comment belongs to.
*/
public function getMaxThread(CommentInterface $comment);
/**
* Gets the maximum encoded thread value for the children of this comment.
*
* @param \Drupal\comment\CommentInterface $comment
* A comment entity.
*
* @return string
* The maximum encoded thread value among all replies of $comment.
*/
public function getMaxThreadPerThread(CommentInterface $comment);
/**
* Calculates the page number for the first new comment.
*
* @param int $total_comments
* The total number of comments that the entity has.
* @param int $new_comments
* The number of new comments that the entity has.
* @param \Drupal\Core\Entity\FieldableEntityInterface $entity
* The entity to which the comments belong.
* @param string $field_name
* The field name on the entity to which comments are attached.
*
* @return array|null
* The page number where first new comment appears. (First page returns 0.)
*/
public function getNewCommentPageNumber($total_comments, $new_comments, FieldableEntityInterface $entity, $field_name);
/**
* Gets the display ordinal or page number for a comment.
*
* @param \Drupal\comment\CommentInterface $comment
* The comment to use as a reference point.
* @param int $comment_mode
* The comment display mode: CommentManagerInterface::COMMENT_MODE_FLAT or
* CommentManagerInterface::COMMENT_MODE_THREADED.
* @param int $divisor
* Defaults to 1, which returns the display ordinal for a comment. If the
* number of comments per page is provided, the returned value will be the
* page number. (The return value will be divided by $divisor.)
*
* @return int
* The display ordinal or page number for the comment. It is 0-based, so
* will represent the number of items before the given comment/page.
*/
public function getDisplayOrdinal(CommentInterface $comment, $comment_mode, $divisor = 1);
/**
* Gets the comment ids of the passed comment entities' children.
*
* @param \Drupal\comment\CommentInterface[] $comments
* An array of comment entities keyed by their ids.
*
* @return array
* The entity ids of the passed comment entities' children as an array.
*/
public function getChildCids(array $comments);
/**
* Retrieves comments for a thread, sorted in an order suitable for display.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity whose comment(s) needs rendering.
* @param string $field_name
* The field_name whose comment(s) needs rendering.
* @param int $mode
* The comment display mode: CommentManagerInterface::COMMENT_MODE_FLAT or
* CommentManagerInterface::COMMENT_MODE_THREADED.
* @param int $comments_per_page
* (optional) The amount of comments to display per page.
* Defaults to 0, which means show all comments.
* @param int $pager_id
* (optional) Pager id to use in case of multiple pagers on the one page.
* Defaults to 0; is only used when $comments_per_page is greater than zero.
*
* @return array
* Ordered array of comment objects, keyed by comment id.
*/
public function loadThread(EntityInterface $entity, $field_name, $mode, $comments_per_page = 0, $pager_id = 0);
/**
* Returns the number of unapproved comments.
*
* @return int
* The number of unapproved comments.
*/
public function getUnapprovedCount();
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
CommentStorageInterface::getChildCids | public | function | Gets the comment ids of the passed comment entities' children. | 1 | |
CommentStorageInterface::getDisplayOrdinal | public | function | Gets the display ordinal or page number for a comment. | 1 | |
CommentStorageInterface::getMaxThread | public | function | Gets the maximum encoded thread value for the top level comments. | 1 | |
CommentStorageInterface::getMaxThreadPerThread | public | function | Gets the maximum encoded thread value for the children of this comment. | 1 | |
CommentStorageInterface::getNewCommentPageNumber | public | function | Calculates the page number for the first new comment. | 1 | |
CommentStorageInterface::getUnapprovedCount | public | function | Returns the number of unapproved comments. | 1 | |
CommentStorageInterface::loadThread | public | function | Retrieves comments for a thread, sorted in an order suitable for display. | 1 | |
ContentEntityStorageInterface::createWithSampleValues | public | function | Creates an entity with sample field values. | 2 | |
EntityStorageInterface::create | public | function | Constructs a new entity object, without permanently saving it. | 1 | |
EntityStorageInterface::delete | public | function | Deletes permanently saved entities. | 1 | |
EntityStorageInterface::deleteRevision | public | function | Delete a specific entity revision. | 4 | |
EntityStorageInterface::FIELD_LOAD_CURRENT | constant | Load the most recent version of an entity's field data. | |||
EntityStorageInterface::FIELD_LOAD_REVISION | constant | Load the version of an entity's field data specified in the entity. | |||
EntityStorageInterface::getAggregateQuery | public | function | Gets an aggregated query instance. | 1 | |
EntityStorageInterface::getEntityType | public | function | Gets the entity type definition. | 1 | |
EntityStorageInterface::getEntityTypeId | public | function | Gets the entity type ID. | 1 | |
EntityStorageInterface::getQuery | public | function | Gets an entity query instance. | 1 | |
EntityStorageInterface::hasData | public | function | Determines if the storage contains any data. | 1 | |
EntityStorageInterface::load | public | function | Loads one entity. | 1 | |
EntityStorageInterface::loadByProperties | public | function | Load entities by their property values. | 1 | |
EntityStorageInterface::loadMultiple | public | function | Loads one or more entities. | 1 | |
EntityStorageInterface::loadRevision | public | function | Load a specific entity revision. | 4 | |
EntityStorageInterface::loadUnchanged | public | function | Loads an unchanged entity from the database. | 1 | |
EntityStorageInterface::resetCache | public | function | Resets the internal, static entity cache. | 1 | |
EntityStorageInterface::restore | public | function | Restores a previously saved entity. | 1 | |
EntityStorageInterface::save | public | function | Saves the entity permanently. | 1 | |
RevisionableStorageInterface::getLatestRevisionId | public | function | Returns the latest revision identifier for an entity. | 2 | |
RevisionableStorageInterface::loadMultipleRevisions | public | function | Loads multiple entity revisions. | 2 | |
TranslatableRevisionableStorageInterface::createRevision | public | function | Creates a new revision starting off from the specified entity object. | Overrides RevisionableStorageInterface::createRevision | 2 |
TranslatableRevisionableStorageInterface::getLatestTranslationAffectedRevisionId | public | function | Returns the latest revision affecting the specified translation. | 2 | |
TranslatableStorageInterface::createTranslation | public | function | Constructs a new entity translation object, without permanently saving it. | 2 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.