public function ShortenFormCurrentPage::buildForm in Shorten URLs 8
Same name and namespace in other branches
- 8.2 src/Form/ShortenFormCurrentPage.php \Drupal\shorten\Form\ShortenFormCurrentPage::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- src/
Form/ ShortenFormCurrentPage.php, line 24
Class
- ShortenFormCurrentPage
- Builds a form which allows shortening of a URL via the UI.
Namespace
Drupal\shorten\FormCode
public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL) {
$form['#attached']['library'][] = 'shorten/shorten';
$form['this_shortened'] = array(
'#type' => 'textfield',
'#size' => 25,
'#default_value' => shorten_url(),
);
return $form;
}