You are here

rest_menu_items.install in Rest menu items 8.2

Same filename and directory in other branches
  1. 3.0.x rest_menu_items.install

File

rest_menu_items.install
View source
<?php

use Drupal\Core\Link;
use Drupal\Core\Url;

/**
 * Implements hook_install().
 *
 * Show a message to the settings page.
 */
function rest_menu_items_install() {
  $settings_link = Link::fromTextAndUrl(t('here'), Url::fromRoute('rest_menu_items.config_form'))
    ->toString();

  // Display a message.
  \Drupal::messenger()
    ->addMessage(t('Click @link to configure Rest Menu Items!', array(
    '@link' => $settings_link,
  )));
}

/**
 * Add our config to the default configuration for Rest Menu Items.
 */
function rest_menu_items_update_8200() {
  $config_factory = \Drupal::configFactory();
  $config = $config_factory
    ->getEditable('rest_menu_items.config');
  $config
    ->set('output_values', [
    'key',
    'title',
    'description',
    'uri',
    'alias',
    'external',
    'absolute',
    'relative',
    'existing',
    'weight',
    'expanded',
    'enabled',
    'uuid',
    'options',
  ]);
  $config
    ->save(TRUE);
}

Functions

Namesort descending Description
rest_menu_items_install Implements hook_install().
rest_menu_items_update_8200 Add our config to the default configuration for Rest Menu Items.