SimplesitemapFormBase.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Drupal\simple_sitemap\Form;
  3. use Symfony\Component\DependencyInjection\ContainerInterface;
  4. use Drupal\Core\Form\ConfigFormBase;
  5. use Drupal\simple_sitemap\Simplesitemap;
  6. /**
  7. * Class SimplesitemapFormBase
  8. * @package Drupal\simple_sitemap\Form
  9. */
  10. abstract class SimplesitemapFormBase extends ConfigFormBase {
  11. /**
  12. * @var \Drupal\simple_sitemap\Simplesitemap
  13. */
  14. protected $generator;
  15. /**
  16. * @var \Drupal\simple_sitemap\Form\FormHelper
  17. */
  18. protected $formHelper;
  19. /**
  20. * SimplesitemapFormBase constructor.
  21. * @param \Drupal\simple_sitemap\Simplesitemap $generator
  22. * @param \Drupal\simple_sitemap\Form\FormHelper $form_helper
  23. */
  24. public function __construct(
  25. Simplesitemap $generator,
  26. FormHelper $form_helper
  27. ) {
  28. $this->generator = $generator;
  29. $this->formHelper = $form_helper;
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public static function create(ContainerInterface $container) {
  35. return new static(
  36. $container->get('simple_sitemap.generator'),
  37. $container->get('simple_sitemap.form_helper')
  38. );
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. protected function getEditableConfigNames() {
  44. return ['simple_sitemap.settings'];
  45. }
  46. /**
  47. *
  48. */
  49. protected function getDonationText() {
  50. return '<div class="description">' . $this->t('If you would like to say thanks and support the development of this module, a <a target="_blank" href="@url">donation</a> will be much appreciated.', ['@url' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5AFYRSBLGSC3W']) . '</div>';
  51. }
  52. }