コード例 #1
0
 /**
  * Renders the autocomplete HTML container.
  *
  * @param \Ivory\GoogleMap\Places\Autocomplete $autocomplete The autocomplete.
  *
  * @return string The HTML output.
  */
 public function renderHtmlContainer(Autocomplete $autocomplete)
 {
     $inputAttributes = $autocomplete->getInputAttributes();
     $inputAttributes['id'] = $autocomplete->getInputId();
     if ($autocomplete->hasValue()) {
         $inputAttributes['value'] = $autocomplete->getValue();
     }
     $htmlAttributes = array();
     foreach ($inputAttributes as $attribute => $value) {
         $htmlAttributes[] = sprintf('%s="%s"', $attribute, $value);
     }
     return sprintf('<input %s />' . PHP_EOL, implode(' ', $htmlAttributes));
 }