<?php

/**
 * @file
 * Allows site administrators to modify configuration.
 */

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function features_ui_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'features.assignment':
      $output = '';
      $output .= '<p>' . t('Bundles are used to collect together groups of features. A bundle provides a shared <a href=":namespace">namespace</a> for all features included in it, which prevents conflicts and helps distinguish your features from those produced for other purposes. Common uses of bundles include:', [':namespace' => 'http://en.wikipedia.org/wiki/Namespace']);
      $output .= '<ul>';
      $output .= '<li>' . t('Custom features for use on a particular site.') . '</li>';
      $output .= '<li>' . t('The features of a given <a href=":distributions">distribution</a>.', [':distributions' => 'https://www.drupal.org/documentation/build/distributions']) . '</li>';
      $output .= '</ul></p>';
      $output .= '<p>' . t('Use the form below to manage bundles. Each bundle comes with a set of assignment methods. By configuring and ordering the assignment methods, you can set the defaults for what does and doesn\'t get packaged into features for your bundle. Use the <em>Bundle</em> select to choose which bundle to edit, or chose <em>--New--</em> to create a new bundle. The <em>Default</em> bundle does not include a namespace and cannot be deleted.') . '</p>';
      return $output;

    case 'features.export':
      $output = '';
      $output .= '<p>' . t('Export packages of configuration into modules.') . '</p>';
      return $output;
  }
}

/**
 * Implements hook_theme().
 */
function features_ui_theme() {
  return [
    'features_listing' => [
      'render element' => 'form',
      'file' => 'features_ui.admin.inc',
      'function' => 'theme_features_listing',
    ],
    'features_assignment_configure_form' => [
      'render element' => 'form',
      'file' => 'features_ui.admin.inc',
      'function' => 'theme_assignment_form',
    ],
    'features_items' => [
      'variables' => [
        'items' => [],
      ],
      'file' => 'features_ui.admin.inc',
      'function' => 'theme_features_items',
    ],
  ];
}
