class Vefl in Views exposed form layout 8.2
Same name and namespace in other branches
- 8.3 src/Vefl.php \Drupal\vefl\Vefl
- 8 src/Vefl.php \Drupal\vefl\Vefl
Helper class that holds all the main Display Suite helper functions.
Hierarchy
- class \Drupal\vefl\Vefl uses StringTranslationTrait
Expanded class hierarchy of Vefl
1 file declares its use of Vefl
- VeflTrait.php in src/
Plugin/ views/ exposed_form/ VeflTrait.php
1 string reference to 'Vefl'
1 service uses Vefl
File
- src/
Vefl.php, line 11
Namespace
Drupal\veflView source
class Vefl {
use StringTranslationTrait;
/**
* The layout plugin manager.
*
* @var \Drupal\Core\Layout\LayoutPluginManagerInterface
*/
protected $layoutManager;
/**
* Constructs a new class object.
*
* @param \Drupal\Core\Layout\LayoutPluginManagerInterface $layout_manager
* The layout plugin manager.
*/
public function __construct(LayoutPluginManagerInterface $layout_manager) {
$this->layoutManager = $layout_manager;
}
/**
* Gets Display Suite layouts.
*/
public function getLayouts() {
static $layouts = FALSE;
if (!$layouts) {
$layouts = $this->layoutManager
->getDefinitions();
}
return $layouts;
}
/**
* Gets Display Suite layouts.
*/
public function getLayoutOptions($layouts = []) {
if (empty($layouts)) {
$layouts = $this
->getLayouts();
}
// Converts layouts array to options.
$layout_options = [];
foreach ($layouts as $key => $layout_definition) {
$optgroup = $this
->t('Other');
// Create new layout option group.
if (!empty($layout_definition
->getCategory())) {
$optgroup = (string) $layout_definition
->getCategory();
}
if (!isset($layout_options[$optgroup])) {
$layout_options[$optgroup] = [];
}
// Stack the layout.
$layout_options[$optgroup][$key] = $layout_definition
->getLabel();
}
// If there is only one $optgroup, move it to the root.
if (count($layout_options) < 2) {
$layout_options = reset($layout_options);
}
return $layout_options;
}
/**
* Returns action fields for views exposed form.
*/
public static function getFormActions() {
$actions = [
'sort_by' => t('Sort by'),
'sort_order' => t('Sort order'),
'items_per_page' => t('Items per page'),
'offset' => t('Offset'),
'submit' => t('Submit button'),
'reset' => t('Reset button'),
];
return $actions;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
Vefl:: |
protected | property | The layout plugin manager. | |
Vefl:: |
public static | function | Returns action fields for views exposed form. | |
Vefl:: |
public | function | Gets Display Suite layouts. | |
Vefl:: |
public | function | Gets Display Suite layouts. | |
Vefl:: |
public | function | Constructs a new class object. |