Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

As a part of #1802750: [Meta] Convert configurable data to ConfigEntity system

The {shortcut_set} table was removed in favor of a new shortcut_set config entity.

Summary

  • Shortcut set becomes a classed object, Drupal\shortcut\Plugin\Core\Entity\ShortcutSet.
  • Wherever the code refers to the $set->set_name, use $set->id().
  • Wherever the code intends to output a name for the shortcut set, use $set->label().

API changes

  • const SHORTCUT_DEFAULT_SET_NAME removed and 'default' string used instead.
  • Removed shortcut_set_get_unique_name() and shortcut_set_name(), the machine names are internally verified for uniqueness
  • Removed shortcut_sets(), ShortcutSet::loadMultiple() can be used instead.
  • Shortcut set add/edit forms now use the entity form controller ShortcutSetFormController.
  • Administration page uses the entity list controller ShortcutSetListController.

Examples

// D7 code
$shortcut_sets = shortcut_sets();
$options = array();
foreach ($shortcut_sets as $name => $set) {
  $options[$name] = check_plain($set->title);
//...
// D8 code
use Drupal\Component\Utility\String;
use Drupal\shortcut\Entity\ShortcutSet;
$shortcut_sets = ShortcutSet::loadMultiple();
$options = array();
foreach ($shortcut_sets as $name => $set) {
  // Sanitation is not needed because of Drupal 8's autoescape functionality.
  $options[$name] = $set->label();
//...

Entity API

// D7 code
$shortcut_set = shortcut_set_load(SHORTCUT_DEFAULT_SET_NAME);
// D8 code
$shortcut_set = ShortcutSet::load('default');
Impacts: 
Module developers

Comments

ParisLiakos’s picture

the machine names are has internal check for unique name

What do you mean here? besides that change notice seems good

andypost’s picture

That shortcut_set_load() still here