public function PhantomJSCaptureTestForm::buildForm in PhantomJS Capture 8
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/ PhantomJSCaptureTestForm.php, line 50
Class
- PhantomJSCaptureTestForm
- Class PhantomJSCaptureTestForm
Namespace
Drupal\phantomjs_capture\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['url'] = array(
'#type' => 'textarea',
'#title' => $this
->t('URL'),
'#required' => TRUE,
'#description' => $this
->t('Absolute URL to the page that you want to capture (it must to be a complete URL with http://). Certain kinds of URLs, such as ones that begin with a # symbol (SPAs or some search engine queries) may not work.'),
'#default_value' => 'https://www.drupal.org',
);
$form['format'] = array(
'#type' => 'select',
'#title' => 'File format',
'#options' => array(
'.png' => 'PNG',
'.jpg' => 'JPEG',
'.pdf' => 'PDF',
),
);
$form['result'] = array(
'#prefix' => '<div id="capture-result">',
'#suffix' => '</div>',
'#markup' => '',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Capture'),
);
return $form;
}