You are here

public function MaestroTemplateBuilderSettingsForm::buildForm in Maestro 3.x

Same name and namespace in other branches
  1. 8.2 modules/maestro_template_builder/src/Form/MaestroTemplateBuilderSettingsForm.php \Drupal\maestro_template_builder\Form\MaestroTemplateBuilderSettingsForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

modules/maestro_template_builder/src/Form/MaestroTemplateBuilderSettingsForm.php, line 32

Class

MaestroTemplateBuilderSettingsForm
Configure settings for this site.

Namespace

Drupal\maestro_template_builder\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('maestro_template_builder.settings');
  $form['maestro_template_builder_admin_settings']['#prefix'] = $this
    ->t('Changes to these settings require a Drupal cache clear to take effect.');
  $form['maestro_template_builder_local_library'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t("Use Raphael as a local library?"),
    '#default_value' => $config
      ->get('maestro_template_builder_local_library'),
    '#description' => $this
      ->t('When checked, the template builder will look locally in /libraries/raphael for raphael.js.  Unchecked will use the remote library location.'),
  ];
  $default = $config
    ->get('maestro_template_builder_remote_library_location');
  $form['maestro_template_builder_remote_library_location'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('URI used to pull the Raphael JS library.'),
    '#default_value' => isset($default) ? $default : '//cdnjs.cloudflare.com/ajax/libs/raphael/2.2.7/raphael.js',
    '#description' => $this
      ->t('Defaults to //cdnjs.cloudflare.com/ajax/libs/raphael/2.2.7/raphael.js'),
    '#required' => FALSE,
  ];
  return parent::buildForm($form, $form_state);
}