You are here

public function FormHelper::negotiateSettings 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::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 272

Class

FormHelper
Class FormHelper

Namespace

Drupal\simple_sitemap\Form

Code

public function negotiateSettings() : FormHelper {
  $this->bundleSettings = $this->generator
    ->setVariants(TRUE)
    ->entityManager()
    ->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->bundleSettings as $variant_id => $settings) {
      if (NULL !== ($instance_id = $this
        ->getInstanceId())) {
        $this->bundleSettings[$variant_id] = $this->generator
          ->setVariants($variant_id)
          ->entityManager()
          ->getEntityInstanceSettings($this
          ->getEntityTypeId(), $instance_id);
      }
      $this->bundleSettings[$variant_id]['bundle_settings'] = $settings;
    }
  }
  return $this;
}