You are here

public function BookNavigation::isAllowed in Display Suite 8.4

Same name and namespace in other branches
  1. 8.2 src/Plugin/DsField/Book/BookNavigation.php \Drupal\ds\Plugin\DsField\Book\BookNavigation::isAllowed()
  2. 8.3 src/Plugin/DsField/Book/BookNavigation.php \Drupal\ds\Plugin\DsField\Book\BookNavigation::isAllowed()

Returns if the field is allowed on the field UI screen.

Return value

bool TRUE when field allowed, FALSE otherwise.

Overrides DsFieldBase::isAllowed

File

src/Plugin/DsField/Book/BookNavigation.php, line 22

Class

BookNavigation
Plugin that the book navigation.

Namespace

Drupal\ds\Plugin\DsField\Book

Code

public function isAllowed() {

  // We only allow the 'full' view mode.
  if ($this
    ->viewMode() != 'full') {
    return FALSE;
  }

  // Get all the allowed types.
  $types = \Drupal::config('book.settings')
    ->get('allowed_types');
  if (!empty($types)) {
    foreach ($types as $type) {
      if ($type) {
        return TRUE;
      }
    }
  }

  // Return false when there where no displays.
  return FALSE;
}