You are here

function social_form_install_configure_form_alter in Open Social 8.7

Same name and namespace in other branches
  1. 8 social.profile \social_form_install_configure_form_alter()
  2. 8.2 social.profile \social_form_install_configure_form_alter()
  3. 8.3 social.profile \social_form_install_configure_form_alter()
  4. 8.4 social.profile \social_form_install_configure_form_alter()
  5. 8.5 social.profile \social_form_install_configure_form_alter()
  6. 8.6 social.profile \social_form_install_configure_form_alter()

Implements hook_form_FORM_ID_alter() for install_configure_form().

Allows the profile to alter the site configuration form.

File

./social.profile, line 127
Enables modules and site configuration for a social site installation.

Code

function social_form_install_configure_form_alter(&$form, FormStateInterface $form_state) {

  // Add 'Social' fieldset and options.
  $form['social'] = [
    '#type' => 'fieldgroup',
    '#title' => t('Open Social optional configuration'),
    '#description' => t('All the required modules and configuration will be automatically installed and imported. You can optionally select additional features or generated demo content.'),
    '#weight' => 50,
  ];
  $social_optional_modules = [
    'social_book' => t('Book functionality'),
    'social_sharing' => t('Share content on social media'),
    'social_event_type' => t('Categorize events in event types'),
    'social_sso' => t('Registration with social networks'),
    'social_search_autocomplete' => t('Suggested results in the search overlay'),
    'social_file_private' => t('Use the private file system for uploaded files (highly recommended)'),
    'inline_form_errors' => t('Inline Form Errors'),
    'page_cache' => t('Cache page for anonymous users (highly recommended)'),
    'dynamic_page_cache' => t('Cache pages for any user (highly recommended)'),
    'social_lets_connect_contact' => t('Adds Open Social Links to the main menu.'),
    'social_lets_connect_usage' => t('Shares usage data to the Open Social team.'),
    'social_group_flexible_group' => t('Flexible group functionality'),
    'social_group_secret' => t('Secret group functionality'),
  ];

  // Checkboxes to enable Optional modules.
  $form['social']['optional_modules'] = [
    '#type' => 'checkboxes',
    '#title' => t('Enable additional features'),
    '#options' => $social_optional_modules,
    '#default_value' => [
      'dynamic_page_cache',
      'inline_form_errors',
      'page_cache',
      'social_file_private',
      'social_search_autocomplete',
      'social_lets_connect_contact',
      'social_lets_connect_usage',
      'social_group_flexible_group',
    ],
  ];

  // Checkboxes to generate demo content.
  $form['social']['demo_content'] = [
    '#type' => 'checkbox',
    '#title' => t('Generate demo content and users'),
    '#description' => t('Will generate files, users, groups, events, topics, comments and posts.'),
  ];

  // Submit handler to enable features.
  $form['#submit'][] = 'social_features_submit';
}