You are here

public function FormHelper::negotiateSettings in Simple XML sitemap 8.3

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

Return value

$this

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

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

File

src/Form/FormHelper.php, line 257

Class

FormHelper
Class FormHelper @package Drupal\simple_sitemap\Form

Namespace

Drupal\simple_sitemap\Form

Code

public function negotiateSettings() {
  $this->settings = $this->generator
    ->setVariants(TRUE)
    ->getBundleSettings($this
    ->getEntityTypeId(), $this
    ->getBundleName(), TRUE, TRUE);
  if ($this
    ->getEntityCategory() === 'instance') {

    //todo Should spit out variant => settings and not just settings; to do this, alter getEntityInstanceSettings() to include 'multiple variants' option.
    foreach ($this->settings as $variant_name => $settings) {
      if (NULL !== ($instance_id = $this
        ->getInstanceId())) {
        $this->settings[$variant_name] = $this->generator
          ->setVariants($variant_name)
          ->getEntityInstanceSettings($this
          ->getEntityTypeId(), $instance_id);
      }
      $this->settings[$variant_name]['bundle_settings'] = $settings;
    }
  }
  return $this;
}