Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getInfo()
 {
     $info = parent::getInfo();
     $class = get_class($this);
     $info['#validate_path'] = TRUE;
     $info['#convert_path'] = self::CONVERT_ROUTE;
     $info['#element_validate'] = array(array($class, 'validateMatchedPath'));
     return $info;
 }
 /**
  * {@inheritdoc}
  */
 public function getInfo()
 {
     $info = parent::getInfo();
     $class = get_class($this);
     // Apply default form element properties.
     $info['#target_type'] = NULL;
     $info['#selection_handler'] = 'default';
     $info['#selection_settings'] = array();
     $info['#tags'] = FALSE;
     $info['#autocreate'] = NULL;
     // This should only be set to FALSE if proper validation by the selection
     // handler is performed at another level on the extracted form values.
     $info['#validate_reference'] = TRUE;
     // IMPORTANT! This should only be set to FALSE if the #default_value
     // property is processed at another level (e.g. by a Field API widget) and
     // it's value is properly checked for access.
     $info['#process_default_value'] = TRUE;
     $info['#element_validate'] = array(array($class, 'validateEntityAutocomplete'));
     array_unshift($info['#process'], array($class, 'processEntityAutocomplete'));
     return $info;
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public static function valueCallback(&$element, $input, FormStateInterface $form_state) {
   return Textfield::valueCallback($element, $input, $form_state);
 }
Ejemplo n.º 4
0
 /**
  * @covers ::valueCallback
  *
  * @dataProvider providerTestValueCallback
  */
 public function testValueCallback($expected, $input)
 {
     $element = [];
     $form_state = $this->prophesize(FormStateInterface::class)->reveal();
     $this->assertSame($expected, Textfield::valueCallback($element, $input, $form_state));
 }