You are here

class SettingsForm in Markdown 8.2

Markdown Settings Form.

Hierarchy

Expanded class hierarchy of SettingsForm

Deprecated

in markdown:8.x-2.0 and is removed from markdown:3.0.0. Use \Drupal\markdown\Form\ParserConfigurationForm instead.

See also

https://www.drupal.org/project/markdown/issues/3142418

File

src/Form/SettingsForm.php, line 23

Namespace

Drupal\markdown\Form
View source
class SettingsForm extends ParserConfigurationForm {

  /**
   * The Markdown service.
   *
   * @var \Drupal\markdown\MarkdownInterface
   */
  protected $markdown;

  /**
   * MarkdownSettingsForm constructor.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
   *   The Config Factory service.
   * @param \Drupal\Core\Config\TypedConfigManagerInterface $typedConfigManager
   *   The Typed Config Manager service.
   * @param \Drupal\Core\Cache\CacheTagsInvalidatorInterface $cacheTagsInvalidator
   *   The Cache Tags Invalidator service.
   * @param \Drupal\Core\Render\ElementInfoManagerInterface $elementInfo
   *   The Element Info Plugin Manager service.
   * @param \Drupal\markdown\MarkdownInterface $markdown
   *   The Markdown service.
   * @param \Drupal\markdown\PluginManager\ParserManagerInterface $parserManager
   *   The Markdown Parser Plugin Manager service.
   * @param \Drupal\markdown\Config\MarkdownConfig $settings
   *   The markdown settings config.
   */
  public function __construct(ConfigFactoryInterface $configFactory, TypedConfigManagerInterface $typedConfigManager, CacheTagsInvalidatorInterface $cacheTagsInvalidator, ElementInfoManagerInterface $elementInfo, MarkdownInterface $markdown, ParserManagerInterface $parserManager, MarkdownConfig $settings) {
    parent::__construct($configFactory, $typedConfigManager, $cacheTagsInvalidator, $elementInfo, $parserManager);
    $this->markdown = $markdown;
    $this->settings = $settings;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container = NULL, MarkdownConfig $settings = NULL) {
    if (!$container) {
      $container = \Drupal::getContainer();
    }
    return new static($container
      ->get('config.factory'), $container
      ->get('config.typed'), $container
      ->get('cache_tags.invalidator'), $container
      ->get('plugin.manager.element_info'), $container
      ->get('markdown'), $container
      ->get('plugin.manager.markdown.parser'), $settings ?: MarkdownConfig::load('markdown.settings', NULL, $container)
      ->setKeyPrefix('parser'));
  }

  /**
   * Indicates whether user is currently viewing the site-wide settings form.
   *
   * @return bool
   *   TRUE or FALSE
   *
   * @deprecated in markdown:8.x-2.0 and is removed from markdown:3.0.0.
   *   No replacement. Check route name yourself.
   * @see https://www.drupal.org/project/markdown/issues/3142418
   */
  public static function siteWideSettingsForm() {
    return \Drupal::routeMatch()
      ->getRouteName() === 'markdown.settings';
  }

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'markdown_configuration';
  }

  /**
   * Builds the subform for markdown settings.
   *
   * Note: building a subform requires that it's ultimately constructed in
   * a #process callback. This is to ensure the complete form (from the parent)
   * has been constructed properly.
   *
   * @param array $element
   *   A render array element.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   *
   * @return array
   *   The modified render array element.
   *
   * @deprecated in markdown:8.x-2.0 and is removed from markdown:3.0.0.
   *   No replacement.
   * @see https://www.drupal.org/project/markdown/issues/3142418
   */
  public function buildSubform(array $element, FormStateInterface $form_state) {
    return $element;
  }

  /**
   * The AJAX callback used to return the parser ajax wrapper.
   *
   * @deprecated in markdown:8.x-2.0 and is removed from markdown:3.0.0. Use
   *   \Drupal\markdown\Plugin\Filter\FilterMarkdown::ajaxChangeParser instead.
   * @see https://www.drupal.org/project/markdown/issues/3142418
   */
  public static function ajaxChangeParser(array $form, FormStateInterface $form_state) {
    return FilterMarkdown::ajaxChangeParser($form, $form_state);
  }

  /**
   * Retrieves configuration from values.
   *
   * @param array $values
   *   An array of values.
   *
   * @return array
   *   The configuration array.
   *
   * @deprecated in markdown:8.x-2.0 and is removed from markdown:3.0.0.
   *   Use \Drupal\markdown\Form\ParserConfigurationForm::getConfigFromValues
   *   instead.
   * @see https://www.drupal.org/project/markdown/issues/3142418
   */
  public function getConfigurationFromValues(array $values) {
    $config = $this
      ->getConfigFromValues($this->settings
      ->getName(), $values);
    return $config
      ->get();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
DependencyTrait::$dependencies protected property The object's dependencies.
DependencyTrait::addDependencies protected function Adds multiple dependencies.
DependencyTrait::addDependency protected function Adds a dependency.
FilterAwareTrait::$filter protected property A Filter plugin.
FilterAwareTrait::getFilter public function
FilterAwareTrait::setFilter public function
FormBase::$configFactory protected property The config factory. 1
FormBase::$requestStack protected property The request stack. 1
FormBase::$routeMatch protected property The route match.
FormBase::config protected function Retrieves a configuration object.
FormBase::configFactory protected function Gets the config factory for this form. 1
FormBase::container private function Returns the service container.
FormBase::currentUser protected function Gets the current user.
FormBase::getRequest protected function Gets the request object.
FormBase::getRouteMatch protected function Gets the route match.
FormBase::logger protected function Gets the logger for a specific channel.
FormBase::redirect protected function Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait::redirect
FormBase::resetConfigFactory public function Resets the configuration factory.
FormBase::setConfigFactory public function Sets the config factory for this form.
FormBase::setRequestStack public function Sets the request stack object to use.
FormTrait::$tokenModuleExists protected static property Flag indicating whether the token module exists.
FormTrait::addDataAttribute public static function Adds a data attribute to an element.
FormTrait::addDataAttributes public static function Adds multiple data attributes to an element.
FormTrait::addElementState public static function Adds a #states selector to an element.
FormTrait::createElement public static function Creates an element, adding data attributes to it if necessary.
FormTrait::createInlineMessage public static function Creates an inline status message to be used in a render array.
FormTrait::createTokenBrowser public static function Creates a Token browser element for use when dealing with tokens.
FormTrait::getElementSelector public static function Retrieves the selector for an element.
FormTrait::resetToDefault public static function Allows a form element to be reset to its default value.
LinkGeneratorTrait::$linkGenerator protected property The link generator. 1
LinkGeneratorTrait::getLinkGenerator Deprecated protected function Returns the link generator.
LinkGeneratorTrait::l Deprecated protected function Renders a link to a route given a route name and its parameters.
LinkGeneratorTrait::setLinkGenerator Deprecated public function Sets the link generator service.
LoggerChannelTrait::$loggerFactory protected property The logger channel factory service.
LoggerChannelTrait::getLogger protected function Gets the logger for a specific channel.
LoggerChannelTrait::setLoggerFactory public function Injects the logger channel factory.
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
MoreInfoTrait::moreInfo protected function Appends existing content with a "More Info" link.
ParserAwareTrait::$parser protected property A Markdown Parser instance.
ParserAwareTrait::getParser public function 1
ParserAwareTrait::setParser public function
ParserConfigurationForm::$cacheTagsInvalidator protected property The Cache Tags Invalidator service.
ParserConfigurationForm::$elementInfo protected property The Element Info Plugin Manager service.
ParserConfigurationForm::$parserManager protected property The Markdown Parser Plugin Manager service.
ParserConfigurationForm::$typedConfigManager protected property
ParserConfigurationForm::buildForm public function Form constructor. Overrides FormInterface::buildForm
ParserConfigurationForm::buildParser protected function Builds the parser form elements.
ParserConfigurationForm::buildParserExtensions protected function Builds the extension settings for a specific parser.
ParserConfigurationForm::buildParserSettings protected function Builds the settings for a specific parser.
ParserConfigurationForm::buildRenderStrategy protected function Builds the render strategy for a specific parser.
ParserConfigurationForm::getConfigFromValues public function Retrieves configuration from an array of values.
ParserConfigurationForm::mapViolationPropertyPathsToFormNames protected static function
ParserConfigurationForm::processSubform public function Process callback for constructing markdown settings for a parser.
ParserConfigurationForm::submitForm public function Form submission handler. Overrides FormInterface::submitForm
ParserConfigurationForm::submitSubform public function Subform submission handler.
ParserConfigurationForm::validateForm public function Form validation handler. Overrides FormBase::validateForm
ParserConfigurationForm::validateSubform public function Subform validation handler.
PluginDependencyTrait::calculatePluginDependencies protected function Calculates and adds dependencies of a specific plugin instance. 1
PluginDependencyTrait::getPluginDependencies protected function Calculates and returns dependencies of a specific plugin instance.
PluginDependencyTrait::moduleHandler protected function Wraps the module handler. 1
PluginDependencyTrait::themeHandler protected function Wraps the theme handler. 1
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 1
RedirectDestinationTrait::getDestinationArray protected function Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.
RedirectDestinationTrait::getRedirectDestination protected function Returns the redirect destination service.
RedirectDestinationTrait::setRedirectDestination public function Sets the redirect destination service.
RendererTrait::$renderer protected static property The Renderer service.
RendererTrait::renderer protected function Retrieves the Renderer service.
SettingsForm::$markdown protected property The Markdown service.
SettingsForm::ajaxChangeParser Deprecated public static function The AJAX callback used to return the parser ajax wrapper.
SettingsForm::buildSubform Deprecated public function Builds the subform for markdown settings.
SettingsForm::create public static function Instantiates a new instance of this class. Overrides ParserConfigurationForm::create
SettingsForm::getConfigurationFromValues Deprecated public function Retrieves configuration from values.
SettingsForm::getFormId public function Returns a unique string identifying the form. Overrides ParserConfigurationForm::getFormId
SettingsForm::siteWideSettingsForm Deprecated public static function Indicates whether user is currently viewing the site-wide settings form.
SettingsForm::__construct public function MarkdownSettingsForm constructor. Overrides ParserConfigurationForm::__construct
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.
UrlGeneratorTrait::$urlGenerator protected property The url generator.
UrlGeneratorTrait::getUrlGenerator Deprecated protected function Returns the URL generator service.
UrlGeneratorTrait::setUrlGenerator Deprecated public function Sets the URL generator service.
UrlGeneratorTrait::url Deprecated protected function Generates a URL or path for a specific route based on the given parameters.