class ContentService in Content Planner 8
Class UserProfileImage.
Hierarchy
- class \Drupal\content_calendar\ContentService
Expanded class hierarchy of ContentService
1 file declares its use of ContentService
- RecentCalendarPublicationsBlock.php in modules/
content_calendar/ src/ Plugin/ DashboardBlock/ RecentCalendarPublicationsBlock.php
File
- modules/
content_calendar/ src/ ContentService.php, line 11
Namespace
Drupal\content_calendarView source
class ContentService {
private $contentTypeConfig;
/**
* ContentService constructor.
*/
public function __construct() {
$this->contentTypeConfig = ContentTypeConfig::loadMultiple();
}
/**
* @return \Drupal\Core\Entity\EntityInterface[]|static[]
*/
public function getContentTypeConfig() {
return $this->contentTypeConfig;
}
/**
*
*/
public function getRecentContent($limit) {
$configs = $this
->getContentTypeConfig();
$types = [];
if (is_array($configs)) {
foreach ($configs as $config) {
$types[] = $config
->getOriginalId();
}
}
if (empty($types)) {
return [];
}
$ids = \Drupal::entityQuery('node')
->condition('status', 1)
->condition('type', $types, 'IN')
->sort('created', 'DESC')
->range(0, $limit)
->execute();
return $nodes = Node::loadMultiple($ids);
}
/**
*
*/
public function getFollowingContent($limit) {
$configs = $this
->getContentTypeConfig();
$types = [];
if (is_array($configs)) {
foreach ($configs as $config) {
$types[] = $config
->getOriginalId();
}
}
if (empty($types)) {
return [];
}
$ids = \Drupal::entityQuery('node')
->condition('status', 0)
->condition('type', $types, 'IN')
->condition('publish_on', NULL, 'IS NOT NULL')
->sort('publish_on', 'ASC')
->range(0, $limit)
->execute();
return $nodes = Node::loadMultiple($ids);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentService:: |
private | property | ||
ContentService:: |
public | function | ||
ContentService:: |
public | function | ||
ContentService:: |
public | function | ||
ContentService:: |
public | function | ContentService constructor. |