public function Regular::buildForm in SimpleAds 8
Return ad campaign form to create an ad.
Return value
array form
Overrides SimpleAdsCampaignBase::buildForm
File
- src/
Plugin/ SimpleAds/ Campaign/ Regular.php, line 22
Class
- Regular
- Regular Campign type.
Namespace
Drupal\simpleads\Plugin\SimpleAds\CampaignCode
public function buildForm(array $form, FormStateInterface $form_state, $type = NULL, $id = NULL) {
$campaigns = (new Campaigns())
->setId($id)
->load();
$form['impressions'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Limit by Impressions'),
'#description' => $this
->t('Selected ads in this campaign will become inactive when the number of impressions reached.'),
];
$form['impressions_limit'] = [
'#type' => 'number',
'#title' => $this
->t('Number of Impressions'),
'#description' => $this
->t('Number of impressions before ads stop appearing.'),
'#states' => [
'visible' => [
'input[name="impressions"]' => [
'checked' => TRUE,
],
],
],
];
$form['clicks'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Limit by Clicks'),
'#description' => $this
->t('Selected ads in this campaign will become inactive when the number of clicks reached.'),
];
$form['clicks_limit'] = [
'#type' => 'number',
'#title' => $this
->t('Number of Clicks'),
'#description' => $this
->t('Number of Clicks (unique) before ads stop appearing.'),
'#states' => [
'visible' => [
'input[name="clicks"]' => [
'checked' => TRUE,
],
],
],
];
$form['start_date'] = [
'#type' => 'datetime',
'#title' => $this
->t('Start Date'),
'#description' => $this
->t('Campaign Start Date'),
];
$form['end_date'] = [
'#type' => 'datetime',
'#title' => $this
->t('End Date'),
'#description' => $this
->t('Campaign End Date'),
];
return $form;
}