public function Text::buildForm in SimpleAds 8
Return ad form to create an ad.
Return value
array form
Overrides SimpleAdsTypeBase::buildForm
File
- src/
Plugin/ SimpleAds/ Type/ Text.php, line 22
Class
- Text
- Text Ad type.
Namespace
Drupal\simpleads\Plugin\SimpleAds\TypeCode
public function buildForm(array $form, FormStateInterface $form_state, $type = NULL, $id = NULL) {
$ad = (new Ads())
->setId($id)
->load();
$options = $ad
->getOptions(TRUE);
$form['text'] = [
'#type' => 'textarea',
'#title' => $this
->t('Advertisement Text'),
'#description' => $this
->t('No HTML allowed'),
'#default_value' => !empty($options['text']) ? $options['text'] : '',
];
return $form;
}