class VboExportCsv in VBO export 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/Action/VboExportCsv.php \Drupal\vbo_export\Plugin\Action\VboExportCsv
- 8 src/Plugin/Action/VboExportCsv.php \Drupal\vbo_export\Plugin\Action\VboExportCsv
Generates csv.
Plugin annotation
@Action(
id = "vbo_export_generate_csv_action",
label = @Translation("Generate csv from selected view results"),
type = "",
pass_context = TRUE,
pass_view = TRUE
)
Hierarchy
- class \Drupal\vbo_export\Plugin\Action\VboExportBase extends \Drupal\views_bulk_operations\Action\ViewsBulkOperationsActionBase implements ContainerFactoryPluginInterface
- class \Drupal\vbo_export\Plugin\Action\VboExportCsv
Expanded class hierarchy of VboExportCsv
File
- src/
Plugin/ Action/ VboExportCsv.php, line 18
Namespace
Drupal\vbo_export\Plugin\ActionView source
class VboExportCsv extends VboExportBase {
const THEME = 'vbo_export_content_csv';
const EXTENSION = 'csv';
/**
* {@inheritdoc}
*
* Add csv separator setting to preliminary config.
*/
public function buildPreConfigurationForm(array $form, array $values, FormStateInterface $form_state) {
$form = parent::buildPreConfigurationForm($form, $values, $form_state);
$form['separator'] = [
'#title' => $this
->t('CSV separator'),
'#type' => 'radios',
'#options' => [
';' => $this
->t('semicolon ";"'),
',' => $this
->t('comma ","'),
'|' => $this
->t('pipe "|"'),
],
'#default_value' => isset($values['separator']) ? $values['separator'] : ';',
];
return $form;
}
/**
* Override the generateOutput method.
*/
protected function generateOutput() {
$output = parent::generateOutput();
// BOM needs to be added to UTF-8 encoded csv file
// to make it easier to read by Excel.
$output = chr(0xef) . chr(0xbb) . chr(0xbf) . (string) $output;
return $output;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
VboExportBase:: |
public | function | ||
VboExportBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
VboExportBase:: |
public | function | ||
VboExportBase:: |
public | function | Execute multiple handler. | |
VboExportBase:: |
protected | function | Output generated string to file. Message user. | |
VboExportBase:: |
public | function | ||
VboExportCsv:: |
public | function |
Add csv separator setting to preliminary config. Overrides VboExportBase:: |
|
VboExportCsv:: |
constant |
Overrides VboExportBase:: |
||
VboExportCsv:: |
protected | function |
Override the generateOutput method. Overrides VboExportBase:: |
|
VboExportCsv:: |
constant |
Overrides VboExportBase:: |