Example #1
0
 /**
  * {@inheritdoc}
  */
 protected function createEntity()
 {
     // Create a "Llama" shortcut.
     $shortcut = Shortcut::create(array('shortcut_set' => 'default', 'title' => t('Llama'), 'weight' => 0, 'link' => [['uri' => 'internal:/admin']]));
     $shortcut->save();
     return $shortcut;
 }
 /**
  * {@inheritdoc}
  */
 protected function createEntity()
 {
     // Create a "Llama" shortcut.
     $shortcut = Shortcut::create(array('set' => 'default', 'title' => t('Llama'), 'weight' => 0, 'path' => 'admin'));
     $shortcut->save();
     return $shortcut;
 }
Example #3
0
 function setUp()
 {
     parent::setUp();
     if ($this->profile != 'standard') {
         // Create Basic page and Article node types.
         $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
         $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
         // Populate the default shortcut set.
         $shortcut = Shortcut::create(array('set' => 'default', 'title' => t('Add content'), 'weight' => -20, 'path' => 'node/add'));
         $shortcut->save();
         $shortcut = Shortcut::create(array('set' => 'default', 'title' => t('All content'), 'weight' => -19, 'path' => 'admin/content'));
         $shortcut->save();
     }
     // Create users.
     $this->admin_user = $this->drupalCreateUser(array('access toolbar', 'administer shortcuts', 'view the administration theme', 'create article content', 'create page content', 'access content overview', 'administer users'));
     $this->shortcut_user = $this->drupalCreateUser(array('customize shortcut links', 'switch shortcut sets'));
     // Create a node.
     $this->node = $this->drupalCreateNode(array('type' => 'article'));
     // Log in as admin and grab the default shortcut set.
     $this->drupalLogin($this->admin_user);
     $this->set = ShortcutSet::load('default');
     shortcut_set_assign_user($this->set, $this->admin_user);
 }