RRSSBField.php in Ridiculously Responsive Social Sharing Buttons 8.2
File
src/Plugin/views/field/RRSSBField.php
View source
<?php
namespace Drupal\rrssb\Plugin\views\field;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
class RRSSBField extends FieldPluginBase {
public function query() {
}
protected function defineOptions() {
$options = parent::defineOptions();
$options['button_set'] = [
'default' => '',
];
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['button_set'] = [
'#type' => 'select',
'#title' => $this
->t('Button set'),
'#options' => rrssb_button_set_names(),
'#description' => $this
->t('Select RRSSB button set to display.'),
'#default_value' => $this->options['button_set'],
'#required' => TRUE,
];
parent::buildOptionsForm($form, $form_state);
}
public function render(ResultRow $values) {
return rrssb_get_buttons($this->options['button_set'], $values->_entity);
}
}