You are here

protected function FormHelper::supports in Simple XML sitemap 8.2

Same name and namespace in other branches
  1. 8.3 src/Form/FormHelper.php \Drupal\simple_sitemap\Form\FormHelper::supports()
  2. 4.x src/Form/FormHelper.php \Drupal\simple_sitemap\Form\FormHelper::supports()

Return value

bool

1 call to FormHelper::supports()
FormHelper::processForm in src/Form/FormHelper.php

File

src/Form/FormHelper.php, line 181

Class

FormHelper
Class FormHelper @package Drupal\simple_sitemap\Form

Namespace

Drupal\simple_sitemap\Form

Code

protected function supports() {

  // Do not alter the form if user lacks certain permissions.
  if (!$this->currentUser
    ->hasPermission('administer sitemap settings')) {
    return FALSE;
  }
  elseif (empty($this
    ->getEntityCategory())) {
    return FALSE;
  }
  elseif (!$this->generator
    ->entityTypeIsEnabled($this
    ->getEntityTypeId())) {
    return FALSE;
  }
  elseif ($this
    ->getEntityCategory() === 'instance' && !$this->generator
    ->bundleIsIndexed($this
    ->getEntityTypeId(), $this
    ->getBundleName())) {
    return FALSE;
  }
  return TRUE;
}