You are here

protected function FormHelper::supports in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 src/Form/FormHelper.php \Drupal\simple_sitemap\Form\FormHelper::supports()
  2. 8.2 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 221

Class

FormHelper
Class FormHelper

Namespace

Drupal\simple_sitemap\Form

Code

protected function supports() : bool {

  // Do not alter the form if it is irrelevant to sitemap generation.
  if (empty($this
    ->getEntityCategory())) {
    return FALSE;
  }

  // Do not alter the form if user lacks certain permissions.
  if (!$this->currentUser
    ->hasPermission('administer sitemap settings')) {
    return FALSE;
  }

  // Do not alter the form if entity is not enabled in sitemap settings.
  if (!$this->generator
    ->entityManager()
    ->entityTypeIsEnabled($this
    ->getEntityTypeId())) {
    return FALSE;
  }
  return TRUE;
}