You are here

function fonts_com_project_info_form in @font-your-face 7.2

Returns project info form array.

2 calls to fonts_com_project_info_form()
fonts_com_project_edit_form in modules/fonts_com/fonts_com.module
Provides form to create or edit a project.
fonts_com_project_form in modules/fonts_com/fonts_com.module
Provides project settings form.

File

modules/fonts_com/fonts_com.module, line 576

Code

function fonts_com_project_info_form($project_id) {
  module_load_include('inc', 'fonts_com', 'api');
  $form = array();
  $form['project_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Project name'),
    '#size' => 50,
  );
  $form['active'] = array(
    '#type' => 'checkbox',
    '#title' => t('Active'),
    '#description' => t('Font updates (enabled status, CSS selectors) affect the active project.'),
  );
  if (variable_get('fonts_com_project', '') == $project_id) {
    $form['active']['#default_value'] = 1;
  }
  else {
    $form['active']['#default_value'] = 0;
  }

  // else
  $form['domains'] = array(
    '#type' => 'fieldset',
    '#title' => 'Publish domains',
  );
  $domain_index = 0;
  if ($project_id != '') {
    $form['project_id'] = array(
      '#type' => 'value',
      '#value' => $project_id,
    );
    $project = fonts_com_get_project_by_id($project_id);
    if ($project) {
      $form['project_name']['#default_value'] = $project->ProjectName;
      $domains = fonts_com_get_domains_in_project($project->ProjectKey);
      foreach ($domains as $domain) {
        $form['domains']['domain[' . $domain_index . ']'] = array(
          '#type' => 'textfield',
          '#size' => 50,
          '#default_value' => $domain->DomainName,
        );
        $domain_index++;
      }

      // foreach
    }

    // if
  }

  // if
  // Add 3 empty fields.
  for ($i = 0; $i < 3; $i++) {
    $form['domains']['domain[' . $domain_index . ']'] = array(
      '#type' => 'textfield',
      '#size' => 50,
    );
    $domain_index++;
  }

  // for
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save project'),
  );
  return $form;
}