function NodeType::getPreviewMode
Gets the preview mode.
phpcs:disable Drupal.Commenting @todo Uncomment new method parameters before drupal:12.0.0.
Parameters
bool $returnAsInt: (deprecated) Whether to return an integer or enum value. The $returnAsInt parameter is deprecated in drupal:11.3.0 and is removed from drupal:13.0.0. phpcs:enable
Return value
\Drupal\node\NodePreviewMode|int Returns the enum case if $returnAsInt is FALSE, otherwise returns the integer equivalent.
Overrides NodeTypeInterface::getPreviewMode
File
-
core/
modules/ node/ src/ Entity/ NodeType.php, line 162
Class
- NodeType
- Defines the Node type configuration entity.
Namespace
Drupal\node\EntityCode
public function getPreviewMode(bool $returnAsInt = TRUE) {
$previewMode = NodePreviewMode::from($this->preview_mode);
if ($returnAsInt) {
@trigger_error('Calling ' . __METHOD__ . ' with the $returnAsInt parameter is deprecated in drupal:11.3.0 and is removed in drupal:13.0.0. See https://www.drupal.org/node/3538666', E_USER_DEPRECATED);
return $previewMode->value;
}
return $previewMode;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.