turnstile

Drupal paywall plugin
Log | Files | Refs | README | LICENSE

commit fd0d4c6d6c41327c6d96a8095b7a3c413f8d0c1e
parent bb02c397e9b19987f37a4c6498d32dbbf015441f
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 19 Oct 2025 16:58:48 +0200

remove debug controller

Diffstat:
Dsrc/Controller/DebugController.php | 62--------------------------------------------------------------
Msrc/TurnstileFieldManager.php | 5++++-
Mturnstile.routing.yml | 9---------
3 files changed, 4 insertions(+), 72 deletions(-)

diff --git a/src/Controller/DebugController.php b/src/Controller/DebugController.php @@ -1,61 +0,0 @@ -<?php - -namespace Drupal\turnstile\Controller; -use Drupal\Core\Controller\ControllerBase; - -use Drupal\Core\Form\ConfigFormBase; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\field\Entity\FieldStorageConfig; -use Drupal\field\Entity\FieldConfig; -use Drupal\Core\Entity\Entity\EntityFormDisplay; -use Drupal\Core\Entity\Entity\EntityViewDisplay; -use Symfony\Component\DependencyInjection\ContainerInterface; - - -/** - * Turnstile debug controller. - */ -class DebugController extends ControllerBase { - - - /** - * Returns a renderable array for a test page. - * - * return [] - */ - public function content() { - - -$config = \Drupal::config('turnstile.settings'); -$enabled_types = $config->get('enabled_content_types') ?: []; - -foreach ($enabled_types as $bundle) { - $field_config = \Drupal\field\Entity\FieldConfig::loadByName('node', $bundle, 'field_price'); - if ($field_config) { - $field_config->setConstraints(['TalerPriceListFormat' => []]); - $field_config->save(); - } -} - - // Temporary debugging code - add to a hook or controller - $constraint_manager = \Drupal::service('validation.constraint'); - $definitions = $constraint_manager->getDefinitions(); - $build = [ - '#markup' => $this->t(isset($definitions['TalerPriceListFormat']) ? 'ok' : 'bad'), - ]; - - $field_config = FieldConfig::loadByName('node', 'article', 'field_price'); - if ($field_config) { - $constraints = $field_config->getConstraints(); - $build = [ - '#markup' => $this->t('constrained' . implode (",", $constraints)), - ]; - - } - - return $build; - } - -} -\ No newline at end of file diff --git a/src/TurnstileFieldManager.php b/src/TurnstileFieldManager.php @@ -14,6 +14,9 @@ use Drupal\Core\StringTranslation\StringTranslationTrait; */ class TurnstileFieldManager { + /** + * For i18n, gives us the t() function. + */ use StringTranslationTrait; /** @@ -90,7 +93,7 @@ class TurnstileFieldManager { 'entity_type' => 'node', 'field_storage' => $field_category_storage, 'bundle' => $bundle, - 'label' => $this->t('Price Category'), + 'label' => $this->t('Price category'), 'description' => $this->t('Select a price category for this content.'), 'required' => FALSE, 'settings' => [ diff --git a/turnstile.routing.yml b/turnstile.routing.yml @@ -51,11 +51,3 @@ entity.turnstile_price_category.delete_form: _title: 'Delete price category' requirements: _permission: 'administer price categories' - -turnstile.debughook: - path: '/turndebug' - defaults: - _controller: '\Drupal\turnstile\Controller\DebugController::content' - _title: 'Turnstile debugger' - requirements: - _permission: 'access content' -\ No newline at end of file