You are here

public function BlogapiCommunicator::getDefaultCommentSetting in Blog API 8

Helper function to determine default comment settings on a content type.

Parameters

$ct: Drupal content type.

Return value

int Return comment status code.

2 calls to BlogapiCommunicator::getDefaultCommentSetting()
BlogapiCommunicator::editPost in src/BlogapiCommunicator.php
Callback for editing a node.
BlogapiCommunicator::newPost in src/BlogapiCommunicator.php
Callback for creating a new node.

File

src/BlogapiCommunicator.php, line 929

Class

BlogapiCommunicator
Class BlogapiCommunicator.

Namespace

Drupal\blogapi

Code

public function getDefaultCommentSetting($ct) {
  $definitions = $this->entityFieldManager
    ->getFieldDefinitions('node', $ct);
  $field_name = $this->blogapiConfig
    ->get('comment_' . $ct);
  $field = $definitions[$field_name];
  $setting = $field
    ->getSetting('default_mode');
  if (!is_null($setting)) {
    return $setting;
  }
  return CommentItemInterface::CLOSED;
}