page_layouts-1.0.1/src/Plugin/views/style/PageLayoutStyle.php
src/Plugin/views/style/PageLayoutStyle.php
<?php
namespace Drupal\page_layouts\Plugin\views\style;
use Drupal\core\form\FormStateInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\views\Plugin\views\style\StylePluginBase;
/**
* Style plugin to render a list layouts.
*
* @ingroup views_style_plugins
*
* @ViewsStyle(
* id = "page_layouts_style",
* title = @Translation("Page Layout"),
* help = @Translation("Render a list of page layout plugins."),
* theme = "views_view_page_layouts",
* display_types = { "normal" }
* )
*/
class PageLayoutStyle extends StylePluginBase {
use StringTranslationTrait;
/**
* Set default options.
*/
protected function defineOptions() {
$options = parent::defineOptions();
return $options;
}
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
// Extra CSS classes.
$form['classes'] = [
'#type' => 'textfield',
'#title' => $this->t('CSS classes'),
'#default_value' => (isset($this->options['classes'])) ? $this->options['classes'] : 'view-page-layouts',
'#description' => $this->t('CSS classes for further customization of this page.'),
];
}
}
