public function ContentHubEntityDependency::setStatus in Acquia Content Hub 8
Sets the status flag for a node entity, if given.
Parameters
int|null $status: The Status flag for a node entity.
File
- src/
ContentHubEntityDependency.php, line 360
Class
- ContentHubEntityDependency
- Content Hub Dependency Class.
Namespace
Drupal\acquia_contenthubCode
public function setStatus($status = NULL) {
if ($this
->getEntityType() == 'node' && isset($status)) {
// Set the entity's status for node entities.
if (isset($this
->getRawEntity()['attributes']['status'])) {
// Get the language.
$languages = array_keys($this->cdf['attributes']['status']['value']);
foreach ($languages as $lang) {
$this->cdf['attributes']['status']['value'][$lang] = $status;
}
}
else {
// Set the status for each language.
$lang_status = [];
foreach ($this->cdf['attributes']['langcode']['value'] as $lang) {
$lang_status[$lang] = $status;
}
$this->cdf['attributes']['status'] = [
'type' => 'integer',
'value' => $lang_status,
];
}
}
}