vendor/symfony/form/ChoiceList/View/ChoiceView.php line 21

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Form\ChoiceList\View;
  11. use Symfony\Component\Translation\TranslatableMessage;
  12. /**
  13. * Represents a choice in templates.
  14. *
  15. * @author Bernhard Schussek <bschussek@gmail.com>
  16. */
  17. class ChoiceView
  18. {
  19. public $label;
  20. public $value;
  21. public $data;
  22. /**
  23. * Additional attributes for the HTML tag.
  24. */
  25. public $attr;
  26. /**
  27. * Additional parameters used to translate the label.
  28. */
  29. public $labelTranslationParameters;
  30. /**
  31. * Creates a new choice view.
  32. *
  33. * @param mixed $data The original choice
  34. * @param string $value The view representation of the choice
  35. * @param string|TranslatableMessage|false $label The label displayed to humans; pass false to discard the label
  36. * @param array $attr Additional attributes for the HTML tag
  37. * @param array $labelTranslationParameters Additional parameters used to translate the label
  38. */
  39. public function __construct($data, string $value, $label, array $attr = [], array $labelTranslationParameters = [])
  40. {
  41. $this->data = $data;
  42. $this->value = $value;
  43. $this->label = $label;
  44. $this->attr = $attr;
  45. $this->labelTranslationParameters = $labelTranslationParameters;
  46. }
  47. }