ShortenFormCurrentPage.php in Shorten URLs 8.2
File
src/Form/ShortenFormCurrentPage.php
View source
<?php
namespace Drupal\shorten\Form;
use Drupal\Core\Form\FormBase;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\Form\FormStateInterface;
class ShortenFormCurrentPage extends FormBase {
public function getFormId() {
return 'shorten_current';
}
public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL) {
$form['#attached']['library'][] = 'shorten/shorten';
$form['this_shortened'] = [
'#type' => 'textfield',
'#size' => 25,
'#default_value' => shorten_url(),
];
return $form;
}
public function submitForm(array &$form, FormStateInterface $form_state) {
}
}