public function FBLikeboxBlock::blockForm in Facebook Page Plugin 8.2
Same name and namespace in other branches
- 8 src/Plugin/Block/FBLikeboxBlock.php \Drupal\fb_likebox\Plugin\Block\FBLikeboxBlock::blockForm()
Overrides BlockPluginTrait::blockForm
File
- src/
Plugin/ Block/ FBLikeboxBlock.php, line 25
Class
- FBLikeboxBlock
- Provides a configurable block with Facebook Likebox's plugin.
Namespace
Drupal\fb_likebox\Plugin\BlockCode
public function blockForm($form, FormStateInterface $form_state) {
$config = $this
->getConfiguration();
// Facebook Widget settings.
$form['fb_likebox_display_settings'] = [
'#type' => 'details',
'#title' => $this
->t('Display options'),
'#open' => TRUE,
];
$form['fb_likebox_display_settings']['url'] = [
'#type' => 'url',
'#title' => $this
->t('Facebook Page URL'),
'#default_value' => $config['url'],
'#description' => $this
->t('Enter the Facebook Page URL. I.e.: https://www.facebook.com/FacebookDevelopers'),
'#required' => TRUE,
];
$form['fb_likebox_display_settings']['app_id'] = [
'#type' => 'textfield',
'#title' => $this
->t('Facebook App ID'),
'#default_value' => $config['app_id'],
];
$form['fb_likebox_display_settings']['hide_header'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Hide cover photo in the header'),
'#default_value' => $config['hide_header'],
];
$form['fb_likebox_display_settings']['stream'] = [
'#type' => 'checkbox',
'#title' => $this
->t("Show posts from the Page's timeline"),
'#default_value' => $config['stream'],
];
$form['fb_likebox_display_settings']['events'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Show posts from the Page'),
'#default_value' => $config['events'],
];
$form['fb_likebox_display_settings']['messages'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Show messages from the Page'),
'#default_value' => $config['messages'],
];
$form['fb_likebox_display_settings']['show_faces'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Show profile photos when friends like this'),
'#default_value' => $config['show_faces'],
];
$form['fb_likebox_display_settings']['title'] = [
'#type' => 'textfield',
'#title' => $this
->t('iFrame title attribute'),
'#default_value' => $config['title'],
'#description' => $this
->t('The value of the title attribute.'),
'#required' => TRUE,
];
$form['fb_likebox_display_settings']['width'] = [
'#type' => 'number',
'#title' => $this
->t('Width'),
'#default_value' => $config['width'],
'#min' => 180,
'#max' => 500,
'#description' => $this
->t('The width of the Facebook likebox. Must be a number between 180 and 500, limits included.'),
'#required' => TRUE,
];
$form['fb_likebox_display_settings']['height'] = [
'#type' => 'number',
'#title' => $this
->t('Height'),
'#default_value' => $config['height'],
'#min' => 70,
'#description' => $this
->t('The height of the plugin in pixels. Must be a number bigger than 70.'),
'#required' => TRUE,
];
$form['fb_likebox_display_settings']['hide_cta'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Hide the custom call to action button (if available)'),
'#default_value' => $config['hide_cta'],
];
$form['fb_likebox_display_settings']['small_header'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Use the small header instead'),
'#default_value' => $config['small_header'],
];
$form['fb_likebox_display_settings']['adapt_container_width'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Try to fit inside the container width'),
'#default_value' => $config['adapt_container_width'],
];
$form['fb_likebox_display_settings']['language'] = [
'#type' => 'select',
'#title' => $this
->t('Choose your language'),
'#options' => $this
->likeboxLanguages(),
'#default_value' => $config['language'],
];
return $form;
}