You are here

public function ParagraphsTableFormatter::bootstrapTableOption in Paragraphs table 8

Support Bootstrap Table.

1 call to ParagraphsTableFormatter::bootstrapTableOption()
ParagraphsTableFormatter::viewElements in src/Plugin/Field/FieldFormatter/ParagraphsTableFormatter.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/ParagraphsTableFormatter.php, line 788

Class

ParagraphsTableFormatter
Plugin implementation of the 'paragraphs_table_formatter' formatter.

Namespace

Drupal\paragraphs_table\Plugin\Field\FieldFormatter

Code

public function bootstrapTableOption($header, $components, $langcode = 'en') {
  $data_option = [
    'toggle' => 'table',
    'search' => "true",
    'show-search-clear-button' => "true",
    'show-refresh' => "true",
    'show-toggle' => "true",
    'show-fullscreen' => "true",
    'show-columns' => "true",
    'show-columns-toggle-all' => "true",
    'show-export' => "true",
    'sortable' => "true",
    'click-to-select' => "true",
    'minimum-count-columns' => "2",
    'show-pagination-switch' => "true",
    'pagination' => "true",
    'page-list' => "[10, 25, 50, 100, all]",
    'show-footer' => "false",
  ];
  $languages = [
    'af' => 'af-ZA',
    'am' => 'am-ET',
    'ar' => 'ar-AE',
    'az' => 'az-Latn-AZ',
    'be' => 'be-BY',
    'bg' => 'bg-BG',
    'ca' => 'ca-ES',
    'cs' => 'cs-CZ',
    'cy' => 'cy-GB',
    'da' => 'da-DK',
    'de' => 'de-DE',
    'el' => 'el-GR',
    'eo' => 'eo-EO',
    'es' => 'es-ES',
    'et' => 'et-EE',
    'eu' => 'eu-EU',
    'fa' => 'fa-IR',
    'fi' => 'fi-fi',
    'fr' => 'fr-FR',
    'ga' => 'ga-IE',
    'gl' => 'gl-ES',
    'gu' => 'gu-IN',
    'he' => 'he-IL',
    'hi' => 'hi-IN',
    'hr' => 'hr-HR',
    'hu' => 'hu-HU',
    'hy' => 'hy-AM',
    'id' => 'id-ID',
    'is' => 'is-IS',
    'it' => 'it-CH',
    'ja' => 'ja-JP',
    'ka' => 'ka-GE',
    'kk' => 'kk-KZ',
    'km' => 'km-KH',
    'ko' => 'ko-KR',
    'ky' => 'ky-KG',
    'lo' => 'lo-LA',
    'lt' => 'lt-LT',
    'lv' => 'lv-LV',
    'mk' => 'mk-MK',
    'ml' => 'ml-IN',
    'mn' => 'mn-MN',
    'ne' => 'ne-NP',
    'nl' => 'nl-NL',
    'nb' => 'nb-NO',
    'nn' => 'nn-NO',
    'pa' => 'pa-IN',
    'pl' => 'pl-PL',
    'pt' => 'pt-PT',
    'ro' => 'ro-RO',
    'ru' => 'ru-RU',
    'si' => 'si-LK',
    'sk' => 'sk-SK',
    'sl' => 'sl-SI',
    'sq' => 'sq-AL',
    'sr' => 'sr-Latn-RS',
    'sv' => 'sv-SE',
    'sw' => 'sw-KE',
    'ta' => 'ta-IN',
    'te' => 'te-IN',
    'th' => 'th-TH',
    'tr' => 'tr-TR',
    'uk' => 'uk-UA',
    'ur' => 'ur-PK',
    'vi' => 'vn-VN',
    'fil' => 'fi-FI',
    'zh-hans' => 'zh-CN',
    'zh-hant' => 'zh-TW',
  ];
  if (!empty($languages[$langcode])) {
    $data_option['locale'] = $languages[$langcode];
  }
  return $data_option;
}