UserCancelMethodsConstraint.php

Namespace

Drupal\user\Plugin\Validation\Constraint

File

core/modules/user/src/Plugin/Validation/Constraint/UserCancelMethodsConstraint.php

View source
<?php

declare (strict_types=1);
namespace Drupal\user\Plugin\Validation\Constraint;

use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Validator\Constraints\Choice;
class UserCancelMethodsConstraint implements ContainerFactoryPluginInterface {
    
    /**
     * {@inheritdoc}
     */
    public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) : Choice {
        $configuration['choices'] = array_keys(user_cancel_methods()['#options']);
        return new Choice($configuration);
    }

}

Classes

Title Deprecated Summary
UserCancelMethodsConstraint

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.