You are here

public static function Ds::getLayouts in Display Suite 8.3

Same name and namespace in other branches
  1. 8.4 src/Ds.php \Drupal\ds\Ds::getLayouts()
  2. 8.2 src/Ds.php \Drupal\ds\Ds::getLayouts()

Gets Display Suite layouts.

Return value

\Drupal\Core\Layout\LayoutDefinition[] A list of layouts.

7 calls to Ds::getLayouts()
ChangeLayoutForm::buildForm in src/Form/ChangeLayoutForm.php
Form constructor.
Ds::layoutExists in src/Ds.php
Check if a layout exists or not.
DsServiceTest::testMissingLayoutService in tests/src/Unit/DsServiceTest.php
@covers ::getLayouts
ds_field_ui_layouts_save in includes/field_ui.inc
Save the layout settings from the 'Manage display' screen.
ds_switch_view_mode_form_node_form_alter in modules/ds_switch_view_mode/ds_switch_view_mode.module
Implements hook_form_BASE_FORM_ID_alter() for node_form.

... See full list

File

src/Ds.php, line 96

Class

Ds
Helper class that holds all the main Display Suite helper functions.

Namespace

Drupal\ds

Code

public static function getLayouts() {
  static $layouts = FALSE;
  if (!$layouts) {

    // This can be called before ds_update_8003() has run. If that is the case
    // return an empty array and don't static cache anything.
    if (!\Drupal::hasService('plugin.manager.core.layout')) {
      return [];
    }
    $layouts = \Drupal::service('plugin.manager.core.layout')
      ->getDefinitions();
  }
  return $layouts;
}