FBLikeboxBlock.php in Facebook Page Plugin 8
File
src/Plugin/Block/FBLikeboxBlock.php
View source
<?php
namespace Drupal\fb_likebox\Plugin\Block;
use Drupal\block\Annotation\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Annotation\Translation;
use Drupal\Core\Form\FormStateInterface;
class FBLikeboxBlock extends BlockBase {
public function defaultConfiguration() {
return array(
'block_example_string' => t('A default value. This block was created at %time', array(
'%time' => date('c'),
)),
);
}
public function blockForm($form, FormStateInterface $form_state) {
$form['block_example_string_text'] = array(
'#type' => 'textfield',
'#title' => t('Block contents'),
'#size' => 60,
'#description' => t('This text will appear in the example block.'),
'#default_value' => $this->configuration['block_example_string'],
);
return $form;
}
public function blockSubmit($form, FormStateInterface $form_state) {
$this->configuration['block_example_string'] = $form_state
->getValue('block_example_string_text');
}
public function build() {
return array(
'#type' => 'markup',
'#markup' => $this->configuration['block_example_string'],
);
}
}
Classes
Name |
Description |
FBLikeboxBlock |
Provides a configurable block with Facebook Likebox's plugin. |