You are here

public static function MegaMenuConfig::create in The Better Mega Menu 8

Same name and namespace in other branches
  1. 2.x src/Entity/MegaMenuConfig.php \Drupal\tb_megamenu\Entity\MegaMenuConfig::create()

Constructs a new entity object, without permanently saving it.

Parameters

array $values: (optional) An array of values to set, keyed by property name. If the entity type has bundles, the bundle key has to be specified.

Return value

static The entity object.

Overrides EntityBase::create

1 call to MegaMenuConfig::create()
tb_megamenu_update_8001 in ./tb_megamenu.install
Migrate any settings from the DB table to configuration objects.

File

src/Entity/MegaMenuConfig.php, line 82

Class

MegaMenuConfig
Defines the Mega Menu Configuration entity.

Namespace

Drupal\tb_megamenu\Entity

Code

public static function create(array $values = []) {
  if (!isset($values['id']) && isset($values['menu']) && isset($values['theme'])) {
    $values['id'] = "{$values['menu']}__{$values['theme']}";
  }
  return parent::create($values);
}