You are here

function feeds_excel_token_info in Feeds Excel 7

Implements of hook_token_info().

Token implementation fo excel file, sheet, row and column. @TODO (2.x): use token chaining with file, sheet, range, row/column, cell

File

./feeds_excel.module, line 120

Code

function feeds_excel_token_info($type = 'all') {
  $types = array(
    'excel-file' => array(
      'name' => t('Excel file'),
      'description' => t('Tokens for an individual excel file.'),
      'needs-data' => 'excel-file',
    ),
    'excel-sheet' => array(
      'name' => t('Excel sheet'),
      'description' => t('Tokens for an individual excel sheet.'),
      'needs-data' => 'excel-sheet',
    ),
    'excel-row' => array(
      'name' => t('Excel row'),
      'description' => t('Tokens for an individual excel row.'),
      'needs-data' => 'excel-row',
    ),
    'excel-column' => array(
      'name' => t('Excel column'),
      'description' => t('Tokens for an individual excel column.'),
      'needs-data' => 'excel-column',
    ),
  );
  $tokens = array(
    // The excel file itself (also known as workbook).
    'excel-file' => array(
      'path' => array(
        'name' => t('Path'),
        'description' => t('The path the excel file is located.'),
      ),
      'url' => array(
        'name' => t('URL'),
        'description' => t('The absolute url the excel file is located.'),
      ),
    ),
    // The excel worksheet
    'excel-sheet' => array(
      'id' => array(
        'name' => t('Sheet ID'),
        'description' => t('Id of the sheet within the excel file.'),
      ),
      'name' => array(
        'name' => t('Name'),
        'description' => t('The human readable name of the sheet'),
      ),
      'cell-1-1-formatted' => array(
        'name' => t('Cell R1C1 (formatted)'),
        'description' => t('Raw data of the given cell within the sheet.'),
      ),
      'cell-1-1' => array(
        'name' => t('Cell R1C1'),
        'description' => t('Raw string of the given cell within the sheet.'),
      ),
    ),
    'excel-row' => array(
      'row' => array(
        'name' => t('Row number'),
        'description' => t('Number of row.'),
      ),
      //'cells' => t('Number of cells in row item.'),
      'range-id' => array(
        'name' => t('Range ID'),
        'description' => t('ID of the define Range of config "iterative"'),
      ),
      'column-offset' => array(
        'name' => t('Column offset'),
        'description' => t('Column offset of row item.'),
      ),
      'column-1-formatted' => array(
        'name' => t('Cell in Column 1 (formatted)'),
        'description' => t('formatted data out of the cell in the given column (1) in the row.'),
      ),
      'column-1' => array(
        'name' => t('Cell in Column 1'),
        'description' => t('Raw data out of the cell in the given column (1) in the row.'),
      ),
      'x-1-formatted' => array(
        'name' => t('Cell with offset 1 (formatted)'),
        'description' => t('Formatted data of cell with given position (1 for first cell) in row.'),
      ),
      'x-1' => array(
        'name' => t('Cell with offset 1'),
        'description' => t('Raw data of cell with given position (1 for first cell) in row.'),
      ),
    ),
    // A single column of an excel sheet.
    'excel-column' => array(
      'row-1-formatted' => array(
        'name' => t('Cell in row 1 (formatted)'),
        'description' => t('formatted data out of given column in current range\'s column.'),
      ),
      'row-1' => array(
        'name' => t('Cell in row 1'),
        'description' => t('Raw data out of given column in current range\'s column.'),
      ),
      'y-1-formatted' => array(
        'name' => t('Cell with offset 1 (formatted)'),
        'description' => t('formatted data of cell with given position in item (1 for first cell in column).'),
      ),
      'y-1' => array(
        'name' => t('Cell with offset 1'),
        'description' => t('Raw data of cell with given position in item (1 for first cell in column).'),
      ),
      'column' => array(
        'name' => t('Number of column'),
        'description' => t('Number of column.'),
      ),
      'column-alpha' => array(
        'name' => t('Name of column'),
        'description' => t('Alpha value of column (like A or BF)'),
      ),
      //'cells' => t('Number of cells in column item.'),
      'row-offset' => array(
        'name' => t('Row offset'),
        'description' => t('Row offset of column item.'),
      ),
    ),
  );
  return array(
    'types' => $types,
    'tokens' => $tokens,
  );
}