function RssFeedsForm::buildForm

Same name in other branches
  1. 9 core/modules/system/src/Form/RssFeedsForm.php \Drupal\system\Form\RssFeedsForm::buildForm()
  2. 10 core/modules/system/src/Form/RssFeedsForm.php \Drupal\system\Form\RssFeedsForm::buildForm()
  3. 11.x core/modules/system/src/Form/RssFeedsForm.php \Drupal\system\Form\RssFeedsForm::buildForm()

Overrides ConfigFormBase::buildForm

File

core/modules/system/src/Form/RssFeedsForm.php, line 32

Class

RssFeedsForm
Configure RSS settings for this site

Namespace

Drupal\system\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
    $rss_config = $this->config('system.rss');
    $form['feed_description'] = [
        '#type' => 'textarea',
        '#title' => t('Feed description'),
        '#default_value' => $rss_config->get('channel.description'),
        '#description' => t('Description of your site, included in each feed.'),
    ];
    $options = [
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10,
        15,
        20,
        25,
        30,
    ];
    $form['feed_default_items'] = [
        '#type' => 'select',
        '#title' => t('Number of items in each feed'),
        '#default_value' => $rss_config->get('items.limit'),
        '#options' => array_combine($options, $options),
        '#description' => t('Default number of items to include in each feed.'),
    ];
    $form['feed_view_mode'] = [
        '#type' => 'select',
        '#title' => t('Feed content'),
        '#default_value' => $rss_config->get('items.view_mode'),
        '#options' => [
            'title' => t('Titles only'),
            'teaser' => t('Titles plus teaser'),
            'fulltext' => t('Full text'),
        ],
        '#description' => t('Global setting for the default display of content items in each feed.'),
    ];
    return parent::buildForm($form, $form_state);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.