示例#1
0
<?php

/**
 * @file
 * Generator settings.
 * // TODO skins are disabled until further testing and dev.
 */
use Drupal\at_core\Theme\ThemeSettingsInfo;
$themeSettingsInfo = new ThemeSettingsInfo();
$sourceThemeOptions = $themeSettingsInfo->baseThemeOptions();
$form['generate'] = array('#type' => 'details', '#title' => 'Generator', '#tree' => TRUE, '#group' => 'generator');
// Friendly name.
$form['generate']['generate_friendly_name'] = array('#type' => 'textfield', '#title' => t('Theme name'), '#maxlength' => 50, '#size' => 30, '#required' => TRUE, '#default_value' => '', '#description' => t('A unique "friendly" name. Letters, spaces and underscores only - numbers and all other chars are stripped or converted.'));
// Machine name.
$form['generate']['generate_machine_name'] = array('#type' => 'machine_name', '#maxlength' => 50, '#size' => 30, '#title' => t('Machine name'), '#required' => TRUE, '#field_prefix' => '', '#default_value' => '', '#machine_name' => array('exists' => array($themeSettingsInfo, 'themeNameExists'), 'source' => array('generate', 'generate_friendly_name'), 'label' => t('Machine name'), 'replace_pattern' => '[^a-z_]+', 'replace' => '_'));
$generate_type_options = array('standard' => t('Standard kit'));
if (!empty($sourceThemeOptions)) {
    $generate_type_options = array('standard' => t('Standard kit'), 'clone' => t('Clone'));
}
$form['generate']['generate_type'] = array('#type' => 'select', '#title' => t('Type'), '#required' => TRUE, '#options' => $generate_type_options);
$form['generate']['generate_type_description_standard_kit'] = array('#type' => 'container', '#markup' => t('Standard kit includes an advanced layout and is designed to fully support the UIKit and Color module (both optional).'), '#attributes' => array('class' => array('generate-type__description')), '#states' => array('visible' => array('select[name="generate[generate_type]"]' => array('value' => 'standard'))));
//$form['generate']['generate_type_description_minimal_kit'] = array(
//  '#type' => 'container',
//  '#markup' => t('Minimal kit includes Drupal core regions only, no UIKit styles, no Color module option. This is a very basic "layout only" theme.'),
//  '#attributes' => array('class' => array('generate-type__description')),
//  '#states' => array(
//    'visible' => array('select[name="generate[generate_type]"]' => array('value' => 'minimal')),
//  ),
//);
$form['generate']['generate_clone_source'] = array('#type' => 'select', '#title' => t('Clone source'), '#options' => $sourceThemeOptions, '#default_value' => '', '#description' => t('Clones are direct copies of existing sub-themes. Use a unique name.'), '#states' => array('visible' => array('select[name="generate[generate_type]"]' => array('value' => 'clone'))));
//$form['generate']['generate_skin_base'] = array(