You are here

class YamlFormAddonsManager in YAML Form 8

Form add-ons manager.

Hierarchy

Expanded class hierarchy of YamlFormAddonsManager

1 string reference to 'YamlFormAddonsManager'
yamlform.services.yml in ./yamlform.services.yml
yamlform.services.yml
1 service uses YamlFormAddonsManager
yamlform.addons_manager in ./yamlform.services.yml
Drupal\yamlform\YamlFormAddonsManager

File

src/YamlFormAddonsManager.php, line 11

Namespace

Drupal\yamlform
View source
class YamlFormAddonsManager implements YamlFormAddonsManagerInterface {
  use StringTranslationTrait;

  /**
   * Projects that provides additional functionality to the YAML Form module.
   *
   * @var array
   */
  protected $projects;

  /**
   * Constructs a YamlFormAddOnsManager object.
   */
  public function __construct() {
    $this->projects = $this
      ->initProjects();
  }

  /**
   * {@inheritdoc}
   */
  public function getProject($name) {
    return $this->projects[$name];
  }

  /**
   * {@inheritdoc}
   */
  public function getProjects($category = NULL) {
    $projects = $this->projects;
    if ($category) {
      foreach ($projects as $project_name => $project) {
        if ($project['category'] != $category) {
          unset($projects[$project_name]);
        }
      }
    }
    return $projects;
  }

  /**
   * {@inheritdoc}
   */
  public function getThirdPartySettings() {
    $projects = $this->projects;
    foreach ($projects as $project_name => $project) {
      if (empty($project['third_party_settings'])) {
        unset($projects[$project_name]);
      }
    }
    return $projects;
  }

  /**
   * {@inheritdoc}
   */
  public function getCategories() {
    $categories = [];
    $categories['config'] = [
      'title' => $this
        ->t('Configuration management'),
    ];
    $categories['integration'] = [
      'title' => $this
        ->t('Integration'),
    ];
    $categories['mail'] = [
      'title' => $this
        ->t('Mail'),
    ];
    $categories['migrate'] = [
      'title' => $this
        ->t('Migrate'),
    ];
    $categories['spam'] = [
      'title' => $this
        ->t('SPAM Protection'),
    ];
    $categories['handler'] = [
      'title' => $this
        ->t('Submission handling'),
    ];
    $categories['validation'] = [
      'title' => $this
        ->t('Validation'),
    ];
    $categories['utility'] = [
      'title' => $this
        ->t('Utility'),
    ];
    return $categories;
  }

  /**
   * Initialize add-on projects.
   *
   * @return array
   *   An associative array containing add-on projects.
   */
  protected function initProjects() {
    $projects = [];

    // Spam: CAPTCHA.
    $projects['captcha'] = [
      'title' => $this
        ->t('CAPTCHA'),
      'description' => $this
        ->t('Provides CAPTCHA for adding challenges to arbitrary forms.'),
      'url' => Url::fromUri('https://www.drupal.org/project/captcha'),
      'category' => 'spam',
    ];

    // Spam: Honeypot.
    $projects['honeypot'] = [
      'title' => $this
        ->t('Honeypot'),
      'description' => $this
        ->t('Mitigates spam form submissions using the honeypot method.'),
      'url' => Url::fromUri('https://www.drupal.org/project/honeypot'),
      'category' => 'spam',
      'third_party_settings' => TRUE,
    ];

    // Validation: Clientside Validation.
    $projects['clientside_validation'] = [
      'title' => $this
        ->t('Clientside Validation'),
      'description' => $this
        ->t('Adds clientside validation to forms.'),
      'url' => Url::fromUri('https://www.drupal.org/project/clientside_validation'),
      'category' => 'validation',
    ];

    // Validation: Validators.
    $projects['validators'] = [
      'title' => $this
        ->t('Validators'),
      'description' => $this
        ->t('Provides Symfony (form) Validators for Drupal 8.'),
      'url' => Url::fromUri('https://www.drupal.org/project/validators'),
      'category' => 'validation',
    ];

    // Integrations: MailChimp.
    $projects['mailchimp'] = [
      'title' => $this
        ->t('YAML Form MailChimp'),
      'description' => $this
        ->t('Posts form submissions to MailChimp list.'),
      'url' => Url::fromUri('https://www.drupal.org/project/yamlform_mailchimp'),
      'category' => 'integration',
    ];

    // Integrations: Webform Views Integration.
    $projects['webform_views'] = [
      'title' => $this
        ->t('Webform Views Integration'),
      'description' => $this
        ->t('Integrates Webforms 8.x-5.x and Views modules.'),
      'url' => Url::fromUri('https://www.drupal.org/node/2838128'),
      'category' => 'integration',
    ];

    // Handler: YAML Form Queue.
    $projects['yamlform_queue'] = [
      'title' => $this
        ->t('YAML Form Queue'),
      'description' => $this
        ->t('Posts form submissions into a Drupal queue.'),
      'url' => Url::fromUri('https://www.drupal.org/project/yamlform_queue'),
      'category' => 'handler',
    ];

    // Mail: Mail System.
    $projects['mailsystem'] = [
      'title' => $this
        ->t('Mail System'),
      'description' => $this
        ->t('Provides a user interface for per-module and site-wide mail system selection.'),
      'url' => Url::fromUri('https://www.drupal.org/project/mailsystem'),
      'category' => 'mail',
    ];

    // Mail: SMTP Authentication Support.
    $projects['smtp'] = [
      'title' => $this
        ->t('SMTP Authentication Support'),
      'description' => $this
        ->t('Allows for site emails to be sent through an SMTP server of your choice.'),
      'url' => Url::fromUri('https://www.drupal.org/project/smtp'),
      'category' => 'mail',
    ];

    // Migrate: Token.
    $projects['token'] = [
      'title' => $this
        ->t('Token'),
      'description' => $this
        ->t('Provides a user interface for the Token API and some missing core tokens.'),
      'url' => Url::fromUri('https://www.drupal.org/project/token'),
      'category' => 'utility',
    ];

    // Migrate: YAML Form Migrate.
    $projects['yamlform_migrate'] = [
      'title' => $this
        ->t('YAML Form Migrate'),
      'description' => $this
        ->t('Provides migration routines from Drupal 6 Webform module to Drupal 8 YAML Form module.'),
      'url' => Url::fromUri('https://www.drupal.org/sandbox/dippers/2819169'),
      'category' => 'migrate',
    ];

    // Config: Drush CMI tools.
    $projects['drush_cmi_tools'] = [
      'title' => $this
        ->t('Drush CMI tools'),
      'description' => $this
        ->t('Provides advanced CMI import and export functionality for CMI workflows. Drush CMI tools should be used to protect YAML Forms from being overwritten during a configuration import.'),
      'url' => Url::fromUri('https://github.com/previousnext/drush_cmi_tools'),
      'category' => 'config',
    ];

    // Configuration Split.
    $projects['config_split'] = [
      'title' => $this
        ->t('Configuration Split'),
      'description' => $this
        ->t('Provides configuration filter for importing and exporting split config.'),
      'url' => Url::fromUri('https://www.drupal.org/project/config_split'),
      'category' => 'config',
    ];
    return $projects;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
YamlFormAddonsManager::$projects protected property Projects that provides additional functionality to the YAML Form module.
YamlFormAddonsManager::getCategories public function Get add-on categories. Overrides YamlFormAddonsManagerInterface::getCategories
YamlFormAddonsManager::getProject public function Get add-on project information. Overrides YamlFormAddonsManagerInterface::getProject
YamlFormAddonsManager::getProjects public function Get add-on projects. Overrides YamlFormAddonsManagerInterface::getProjects
YamlFormAddonsManager::getThirdPartySettings public function Get add-on projects that support third party settings. Overrides YamlFormAddonsManagerInterface::getThirdPartySettings
YamlFormAddonsManager::initProjects protected function Initialize add-on projects.
YamlFormAddonsManager::__construct public function Constructs a YamlFormAddOnsManager object.