You are here

public function GridStackBase::getOptions in GridStack 8.2

Returns the GridStack options by group, or property.

Parameters

string $group: The name of setting group: breakpoints, grids, settings.

string $property: The name of specific property: resizable, draggable, etc.

Return value

mixed|array|null Available options by $group, $property, all, or NULL.

Overrides GridStackBaseInterface::getOptions

1 call to GridStackBase::getOptions()
GridStack::getSetting in src/Entity/GridStack.php
Returns the value of a gridstack setting.

File

src/Entity/GridStackBase.php, line 83

Class

GridStackBase
Defines the base class for GridStack configuration entity.

Namespace

Drupal\gridstack\Entity

Code

public function getOptions($group = NULL, $property = NULL) {
  $default = self::load('default');
  $default_options = $default ? $default->options : [];
  $options = $this->options ? NestedArray::mergeDeep($default_options, $this->options) : $default_options;
  if ($group) {
    if (is_array($group)) {
      return NestedArray::getValue($options, $group);
    }
    elseif (isset($property) && isset($options[$group])) {
      return isset($options[$group][$property]) ? $options[$group][$property] : NULL;
    }
    return isset($options[$group]) ? $options[$group] : $options;
  }
  return $options;
}