You are here

public function FeedsExcelParser::configForm in Feeds Excel 7.2

Same name and namespace in other branches
  1. 6 ExcelParser.inc \FeedsExcelParser::configForm()
  2. 7 ExcelParser.inc \FeedsExcelParser::configForm()

File

./FeedsExcelParser.inc, line 200
Contains FeedsExcelParser.

Class

FeedsExcelParser
Provides feeds parser class for Excel files.

Code

public function configForm(&$form_state) {
  $form = array();
  $form['chunk_size'] = array(
    '#type' => 'select',
    '#title' => t('Chunk size'),
    '#options' => drupal_map_assoc(array(
      1,
      5,
      10,
      20,
      50,
      100,
      200,
    )),
    '#description' => t("Select quantity of rows which will be parsed per ounce. <b>Notice: selected quantity will be multiplied on sheets' quantity.</b>"),
    '#default_value' => $this->config['chunk_size'],
  );
  $form['no_headers'] = array(
    '#type' => 'checkbox',
    '#title' => t('No headers'),
    '#description' => t("Check if the imported Excel file does not start with a header row. If checked, mapping sources must be named '0', '1', '2' etc."),
    '#default_value' => $this->config['no_headers'],
  );
  $form['calculate'] = array(
    '#type' => 'checkbox',
    '#title' => t('Calculate'),
    '#description' => t('Check if need to calculate cells data via getCalculatedValue()'),
    '#default_value' => $this->config['calculate'],
  );
  $form['sheets'] = array(
    '#type' => 'fieldset',
    '#title' => t('Sheets settings'),
    '#tree' => TRUE,
  );
  $form['sheets']['parse_type'] = array(
    '#type' => 'select',
    '#title' => t('How to parse?'),
    '#default_value' => $this->config['sheets']['parse_type'],
    '#options' => array(
      'all' => t('All sheets'),
      'first' => t('First sheet'),
      'title' => t('By title'),
      'index' => t('By index'),
    ),
  );
  $form['sheets']['parse_value'] = array(
    '#type' => 'textfield',
    '#default_value' => $this->config['sheets']['parse_value'],
    '#states' => array(
      'visible' => array(
        array(
          array(
            'select[name="sheets[parse_type]"]' => array(
              'value' => 'title',
            ),
          ),
          'or',
          array(
            'select[name="sheets[parse_type]"]' => array(
              'value' => 'index',
            ),
          ),
        ),
      ),
    ),
  );
  $form['sheets']['map_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Source key of sheet title'),
    '#description' => t('If filled, sheet title will be available in mapping.'),
    '#default_value' => $this->config['sheets']['map_title'],
  );
  return $form;
}