function paragraphs_table_field_formatter_settings_form in Paragraphs table 7
Implements hook_field_formatter_settings_form().
File
- ./
paragraphs_table.module, line 37 - Module file for Paragraph table module.
Code
function paragraphs_table_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$element = [];
$element['duplicate'] = array(
'#type' => 'textfield',
'#title' => t('Duplicate link title'),
'#description' => t("Leave it empty if you don't want duplicate row"),
'#default_value' => !empty($settings['duplicate']) ? $settings['duplicate'] : '',
);
if (module_exists('quick_data')) {
$element['import'] = [
'#type' => 'textfield',
'#title' => t('Import link title'),
'#description' => t("Leave it blank if you don't want to import csv data"),
'#default_value' => !empty($settings['import']) ? $settings['import'] : '',
];
}
$element['add'] = array(
'#type' => 'textfield',
'#title' => t('Add Link title'),
'#description' => t("Leave the title empty if you don't want add button"),
'#default_value' => !empty($settings['add']) ? $settings['add'] : '',
);
$element['edit'] = array(
'#type' => 'textfield',
'#title' => t('Edit Link title'),
'#description' => t("Leave the title empty if you don't want edit row"),
'#default_value' => !empty($settings['edit']) ? $settings['edit'] : '',
);
$element['delete'] = array(
'#type' => 'textfield',
'#title' => t('Delete Link title'),
'#description' => t("Leave the title empty if you don't want delete row"),
'#default_value' => !empty($settings['delete']) ? $settings['delete'] : '',
);
if ($display['type'] == 'paragraphs_table_view') {
$element['hide_empty'] = array(
'#type' => 'checkbox',
'#title' => t('Hide empty paragraphs'),
'#description' => t('If enabled, nothing will be displayed for an empty paragraphs (not even the add link).'),
'#default_value' => $settings['hide_empty'],
);
$element['empty'] = array(
'#type' => 'checkbox',
'#title' => t('Hide empty columns'),
'#description' => t('If checked, hide empty paragraphs table columns.'),
'#default_value' => $settings['empty'],
);
$element['vertical'] = array(
'#type' => 'checkbox',
'#title' => t('Table vertical'),
'#description' => t('If checked, table data will show in vertical mode.'),
'#default_value' => !empty($settings['vertical']) ? $settings['vertical'] : NULL,
);
$element['ajax'] = array(
'#type' => 'checkbox',
'#title' => t('Use ajax to load'),
'#description' => t('If checked, ajax will load table data.'),
'#default_value' => !empty($settings['ajax']) ? $settings['ajax'] : NULL,
);
if (module_exists('datatables')) {
$element['datatables'] = array(
'#type' => 'checkbox',
'#title' => t('Support datatables'),
'#description' => t('If checked, datatables will load table data.'),
'#default_value' => !empty($settings['datatables']) ? $settings['ajax'] : NULL,
);
}
}
return $element;
}