class ContentPublishingActions in Acquia Lift Connector 8.4
Contains helper methods for managing Content Hub exports.
@package Drupal\acquia_lift_publisher
Hierarchy
- class \Drupal\acquia_lift_publisher\ContentPublishingActions
Expanded class hierarchy of ContentPublishingActions
1 string reference to 'ContentPublishingActions'
- acquia_lift_publisher.services.yml in modules/
acquia_lift_publisher/ acquia_lift_publisher.services.yml - modules/acquia_lift_publisher/acquia_lift_publisher.services.yml
1 service uses ContentPublishingActions
- acquia_lift_publisher.publishing_actions in modules/
acquia_lift_publisher/ acquia_lift_publisher.services.yml - Drupal\acquia_lift_publisher\ContentPublishingActions
File
- modules/
acquia_lift_publisher/ src/ ContentPublishingActions.php, line 16
Namespace
Drupal\acquia_lift_publisherView source
class ContentPublishingActions {
/**
* The acquia lift publishing settings.
*
* @var \Drupal\Core\Config\ImmutableConfig
* @see \Drupal\acquia_lift_publisher\Form\ContentPublishingForm
*/
private $publisherSettings;
/**
* The Content Hub export queue.
*
* @var \Drupal\acquia_contenthub_publisher\ContentHubExportQueue
*/
private $exportQueue;
/**
* ContentPublishingActions constructor.
*
* @param \Drupal\acquia_contenthub_publisher\ContentHubExportQueue $content_hub_export_queue
* The Content Hub export queue service.
* @param \Drupal\Core\Config\ImmutableConfig $config
* The acquia lift publishing settings.
*/
public function __construct(ContentHubExportQueue $content_hub_export_queue, ImmutableConfig $config) {
$this->exportQueue = $content_hub_export_queue;
$this->publisherSettings = $config;
}
/**
* Triggers the Content Hub export process.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The current entity.
*/
public function triggerQueue(EntityInterface $entity) : void {
if (!$entity instanceof ContentEntityInterface || !$this->publisherSettings
->get(ContentPublishingForm::$pushSettingField)) {
return;
}
if ($this->exportQueue
->getQueueCount() < 1) {
return;
}
$this->exportQueue
->processQueueItems();
}
/**
* Returns publisher setting value by its name.
*
* @param $field_name
* @param null $default_value
*
* @return array|mixed|null
*/
public function getPublicationsFieldValue($field_name, $default_value = NULL) {
return $this->publisherSettings
->get($field_name) ?? $default_value;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentPublishingActions:: |
private | property | The Content Hub export queue. | |
ContentPublishingActions:: |
private | property | The acquia lift publishing settings. | |
ContentPublishingActions:: |
public | function | Returns publisher setting value by its name. | |
ContentPublishingActions:: |
public | function | Triggers the Content Hub export process. | |
ContentPublishingActions:: |
public | function | ContentPublishingActions constructor. |