Skip to content

Instantly share code, notes, and snippets.

View tanmayk's full-sized avatar
🎯
Focusing

Tanmay Khedekar tanmayk

🎯
Focusing
  • Opensource Seed
  • India
View GitHub Profile
* @ViewsStyle(
* id = "scroller",
* title = @Translation("Scroller"),
* help = @Translation("Render a listing of view data."),
* theme = "views_view_scroller",
* display_types = { "normal" }
* )
class Scroller extends StylePluginBase {
protected function defineOptions() {
$options = parent::defineOptions();
$options['height'] = array('default' => '354');
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['height'] = array(
'#type' => 'textfield',
'#title' => $this->t('Height'),
'#description' => $this->t('Default height of header.'),
'#size' => '6',
'#default_value' => $this->options['height'],
'#required' => TRUE,
<?php
/**
* @file
* My Scroller Views module help and theme functions.
*/
// Store Scroller preprocess theme functions in a separate .inc file.
\Drupal::moduleHandler()->loadInclude('my_scroller', 'inc', 'my_scroller.theme');
<?php
/**
* @file
* Theme for My Scroller views.
*/
/**
* Prepares variables for views scroller templates.
*
* theme = "views_view_scroller",
YAML
-
name: 'Parent 1'
children:
-
name: 'Child 1'
children:
-
name: 'Child 11'
@tanmayk
tanmayk / features-revert-d8.php
Created January 29, 2019 09:19
D8 equivalent of features_revert.
<?php
$manager = \Drupal::service('features.manager');
$module = 'MODULE_MACHINE_NAME';
$feature = $manager->loadPackage($module, TRUE);
$config_to_create = [
'CONFIG_NAME_1' => '',
'CONFIG_NAME_2' => '',
];
// Import the configurations.
version: 2
jobs:
build:
docker:
- image: osseed/drupal8:7.2
- image: circleci/mysql:5.7
environment:
MYSQL_DATABASE: drupal
MYSQL_ROOT_USERNAME: root
MYSQL_ROOT_PASSWORD: root