コード例 #1
0
 /**
  * Creates a new simple choice list.
  *
  * @param array $choices The array of choices with the choices as keys and
  *                       the labels as values
  */
 public function __construct(array $choices)
 {
     parent::__construct($choices, $choices);
 }
コード例 #2
0
 /**
  * Creates a new simple choice list.
  *
  * @param array $choices          The array of choices with the choices as keys and
  *                                the labels as values. Choices may also be given
  *                                as hierarchy of unlimited depth by creating nested
  *                                arrays. The title of the sub-hierarchy is stored
  *                                in the array key pointing to the nested array.
  * @param array $preferredChoices A flat array of choices that should be
  *                                presented to the user with priority.
  */
 public function __construct(array $choices, array $preferredChoices = array())
 {
     // Flip preferred choices to speed up lookup
     parent::__construct($choices, $choices, array_flip($preferredChoices));
 }