You are here

protected function SidrTrigger::getSidrJsOptions in Sidr: Accessible Mobile Menus 8.3

Same name and namespace in other branches
  1. 8 src/Plugin/Block/SidrTrigger.php \Drupal\sidr\Plugin\Block\SidrTrigger::getSidrJsOptions()
  2. 8.2 src/Plugin/Block/SidrTrigger.php \Drupal\sidr\Plugin\Block\SidrTrigger::getSidrJsOptions()

Returns block configuration as options for the Sidr jQuery plugin.

Return value

array Sidr options.

1 call to SidrTrigger::getSidrJsOptions()
SidrTrigger::build in src/Plugin/Block/SidrTrigger.php
Builds and returns the renderable array for this block plugin.

File

src/Plugin/Block/SidrTrigger.php, line 274

Class

SidrTrigger
Provides a trigger button with Sidr integration.

Namespace

Drupal\sidr\Plugin\Block

Code

protected function getSidrJsOptions() {
  $conf = $this
    ->getConfiguration();
  $output = [
    'source' => $conf['sidr_source'],
    'name' => $conf['sidr_name'],
    'side' => $conf['sidr_side'],
    'method' => $conf['sidr_method'],
    'speed' => $conf['sidr_speed'],
    'timing' => is_numeric($conf['sidr_timing']) ? (int) $conf['sidr_timing'] : $conf['sidr_timing'],
    'renaming' => $conf['sidr_renaming'],
    'displace' => $conf['sidr_displace'],
    'nocopy' => $conf['sidr_nocopy'],
    'body' => $conf['sidr_displace'] ? $conf['sidr_body'] : '',
  ];
  return array_filter($output, [
    __CLASS__,
    'isOptionNonEmpty',
  ]);
}