From 37cb0caeb442d82c9aed61d1e8ed3b245d21ab3e Mon Sep 17 00:00:00 2001 From: Kevin Kaland <kevin@wizonesolutions.com> Date: Tue, 31 Mar 2015 12:24:59 +0200 Subject: [PATCH] Convert overview table to Views. --- config/install/views.view.fillpdf_forms.yml | 559 ++++++++++++++++++++ fillpdf.admin.inc | 154 +++--- fillpdf.install | 194 ------- src/FillPdfFormViewsData.php | 2 +- src/Form/FillPdfOverviewForm.php | 45 +- 5 files changed, 639 insertions(+), 315 deletions(-) create mode 100644 config/install/views.view.fillpdf_forms.yml delete mode 100644 fillpdf.install diff --git a/config/install/views.view.fillpdf_forms.yml b/config/install/views.view.fillpdf_forms.yml new file mode 100644 index 0000000..2741e43 --- /dev/null +++ b/config/install/views.view.fillpdf_forms.yml @@ -0,0 +1,559 @@ +uuid: 6bcf8b09-1506-4bf8-8101-1a57e5b7d246 +langcode: en +status: true +dependencies: + module: + - file + - fillpdf +id: fillpdf_forms +label: 'FillPDF forms' +module: views +description: '' +tag: '' +base_table: fillpdf_forms +base_field: fid +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: none + options: { } + cache: + type: none + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: false + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: none + options: + items_per_page: null + offset: 0 + style: + type: table + options: + grouping: { } + row_class: '' + default_row_class: true + override: true + sticky: false + caption: '' + summary: '' + description: '' + columns: + fid: fid + admin_title: admin_title + title: title + uri: uri + nothing: nothing + nothing_1: nothing_1 + info: + fid: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + admin_title: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + title: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + uri: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + nothing: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + nothing_1: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + default: '-1' + empty_table: false + row: + type: fields + fields: + fid: + id: fid + table: fillpdf_forms + field: fid + relationship: none + group_type: group + admin_label: '' + label: 'FillPDF Form ID' + exclude: true + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: '' + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + set_precision: false + precision: 0 + decimal: . + separator: ',' + format_plural: false + format_plural_singular: '1' + format_plural_plural: '@count' + prefix: '' + suffix: '' + entity_type: fillpdf_form + entity_field: fid + plugin_id: numeric + admin_title: + id: admin_title + table: fillpdf_forms + field: admin_title + relationship: none + group_type: group + admin_label: '' + label: 'Administrative title' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: '' + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + entity_type: fillpdf_form + entity_field: admin_title + plugin_id: standard + title: + id: title + table: fillpdf_forms + field: title + relationship: none + group_type: group + admin_label: '' + label: 'Filename pattern' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: '' + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + entity_type: fillpdf_form + entity_field: title + plugin_id: standard + uri: + id: uri + table: file_managed + field: uri + relationship: file + group_type: group + admin_label: '' + label: Location + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: '' + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_file: false + file_download_path: false + entity_type: file + entity_field: uri + plugin_id: file_uri + nothing: + id: nothing + table: views + field: nothing + relationship: none + group_type: group + admin_label: '' + label: Operations + exclude: false + alter: + alter_text: true + text: Edit + make_link: true + path: 'admin/structure/fillpdf/{{ fid }}' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: '' + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: false + plugin_id: custom + nothing_1: + id: nothing_1 + table: views + field: nothing + relationship: none + group_type: group + admin_label: 'Operations: Delete' + label: '' + exclude: false + alter: + alter_text: true + text: Delete + make_link: true + path: 'admin/structure/fillpdf/{{ fid }}/delete' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: '' + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: false + plugin_id: custom + nothing_2: + id: nothing_2 + table: views + field: nothing + relationship: none + group_type: group + admin_label: 'Operations: Export field mappings' + label: '' + exclude: false + alter: + alter_text: true + text: 'Export field mappings' + make_link: true + path: 'admin/structure/fillpdf/{{ fid }}/export' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: '' + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: false + plugin_id: custom + nothing_3: + id: nothing_3 + table: views + field: nothing + relationship: none + group_type: group + admin_label: 'Operations: Import field mappings' + label: '' + exclude: false + alter: + alter_text: true + text: 'Import field mappings' + make_link: true + path: 'admin/structure/fillpdf/{{ fid }}/import' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: '' + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: false + plugin_id: custom + filters: { } + sorts: { } + title: 'FillPDF forms' + header: { } + footer: { } + empty: { } + relationships: + file: + id: file + table: fillpdf_forms + field: file + relationship: none + group_type: group + admin_label: File + required: false + entity_type: fillpdf_form + entity_field: file + plugin_id: standard + arguments: { } + display_extenders: { } + field_langcode: '***LANGUAGE_language_content***' + field_langcode_add_to_query: null + block_1: + display_plugin: block + id: block_1 + display_title: Block + position: 1 + display_options: + display_extenders: { } + field_langcode: '***LANGUAGE_language_content***' + field_langcode_add_to_query: null diff --git a/fillpdf.admin.inc b/fillpdf.admin.inc index 49d3d61..234a268 100644 --- a/fillpdf.admin.inc +++ b/fillpdf.admin.inc @@ -65,85 +65,85 @@ // return $form; //} -/** - * Makes sure the Upload was provided (want to validate .pdf here too) - */ -function fillpdf_forms_admin_validate($form, &$form_state) { - // uploading anything? - $file = $_FILES['files']['name']['upload_pdf']; - if (!$file) { - form_set_error('url', t('A PDF must be provided.')); - } - - $validate_file = _fillpdf_validate_upload($file); - if (isset($validate_file['#error'])) { - form_set_error('url', $validate_file['#message']); - } -} - -function _fillpdf_validate_upload($file) { - // from includes/file.inc, line 634, but can't use that function because file not an object yet - if (!preg_match('/\.pdf$/i', $file)) { - return array( - '#error' => TRUE, - '#message' => t('Only PDF files are allowed'), - ); - } - - // directory exist or writeable? - $dir = file_build_uri('fillpdf'); - file_prepare_directory($dir, FILE_CREATE_DIRECTORY); - - return TRUE; -} +///** +// * Makes sure the Upload was provided (want to validate .pdf here too) +// */ +//function fillpdf_forms_admin_validate($form, &$form_state) { +// // uploading anything? +// $file = $_FILES['files']['name']['upload_pdf']; +// if (!$file) { +// form_set_error('url', t('A PDF must be provided.')); +// } +// +// $validate_file = _fillpdf_validate_upload($file); +// if (isset($validate_file['#error'])) { +// form_set_error('url', $validate_file['#message']); +// } +//} -/** - * Creates a new Form from the uploaded PDF, including parsed fields - */ -function fillpdf_forms_admin_submit($form, &$form_state) { - $fid = _fillpdf_save_upload('upload_pdf'); - if (is_numeric($fid)) { - $form_state['redirect'] = "admin/structure/fillpdf/$fid"; - } -} +//function _fillpdf_validate_upload($file) { +// // from includes/file.inc, line 634, but can't use that function because file not an object yet +// if (!preg_match('/\.pdf$/i', $file)) { +// return array( +// '#error' => TRUE, +// '#message' => t('Only PDF files are allowed'), +// ); +// } +// +// // directory exist or writeable? +// $dir = file_build_uri('fillpdf'); +// file_prepare_directory($dir, FILE_CREATE_DIRECTORY); +// +// return TRUE; +//} -function _fillpdf_save_upload($form_key, $fid = NULL) { - $dir = file_build_uri('fillpdf'); - // $validators not working, so I just checked manually - // in fillpdf_forms_validate() - $validators = array('file_validate_extensions' => array('pdf')); - if ($file = file_save_upload($form_key, $validators, $dir, FILE_EXISTS_RENAME)) { - drupal_set_message(t('<strong>@filename</strong> was successfully uploaded.', array('@filename' => $file->filename))); - $file->status = FILE_STATUS_PERMANENT; - $file = file_save($file); - // Does this file already exist in {fillpdf_forms}? - // If so, don't re-insert it. - if (isset($fid) === FALSE) { - db_insert('fillpdf_forms') - ->fields(array( - 'fid' => $file->fid, - 'title' => $file->filename, - 'url' => $file->uri, - )) - ->execute(); - $fid = $file->fid; - } - else { - db_update('fillpdf_forms') - ->fields(array( - 'url' => $file->uri, - )) - ->condition('fid', $fid) - ->execute(); - } - fillpdf_parse_pdf($fid); - return $fid; - } - else { - // commented out because even though error if file doesn't upload right, not error if they dont' upload a file (& this is still triggered) - drupal_set_message(t('Error saving file to @dir', array('@dir' => $dir)), 'error'); - } -} +///** +// * Creates a new Form from the uploaded PDF, including parsed fields +// */ +//function fillpdf_forms_admin_submit($form, &$form_state) { +// $fid = _fillpdf_save_upload('upload_pdf'); +// if (is_numeric($fid)) { +// $form_state['redirect'] = "admin/structure/fillpdf/$fid"; +// } +//} +// +//function _fillpdf_save_upload($form_key, $fid = NULL) { +// $dir = file_build_uri('fillpdf'); +// // $validators not working, so I just checked manually +// // in fillpdf_forms_validate() +// $validators = array('file_validate_extensions' => array('pdf')); +// if ($file = file_save_upload($form_key, $validators, $dir, FILE_EXISTS_RENAME)) { +// drupal_set_message(t('<strong>@filename</strong> was successfully uploaded.', array('@filename' => $file->filename))); +// $file->status = FILE_STATUS_PERMANENT; +// $file = file_save($file); +// // Does this file already exist in {fillpdf_forms}? +// // If so, don't re-insert it. +// if (isset($fid) === FALSE) { +// db_insert('fillpdf_forms') +// ->fields(array( +// 'fid' => $file->fid, +// 'title' => $file->filename, +// 'url' => $file->uri, +// )) +// ->execute(); +// $fid = $file->fid; +// } +// else { +// db_update('fillpdf_forms') +// ->fields(array( +// 'url' => $file->uri, +// )) +// ->condition('fid', $fid) +// ->execute(); +// } +// fillpdf_parse_pdf($fid); +// return $fid; +// } +// else { +// // commented out because even though error if file doesn't upload right, not error if they dont' upload a file (& this is still triggered) +// drupal_set_message(t('Error saving file to @dir', array('@dir' => $dir)), 'error'); +// } +//} /* ---------------- Form Edit --------------------*/ diff --git a/fillpdf.install b/fillpdf.install deleted file mode 100644 index f9e0b3c..0000000 --- a/fillpdf.install +++ /dev/null @@ -1,194 +0,0 @@ -<?php - -/** - * @file - * Install - */ - -/** - * Implements hook_schema(). - */ -function fillpdf_schema() { - $schema = array(); - -// $schema['fillpdf_forms'] = array( -// 'fields' => array( -// 'fid' => array( -// 'type' => 'int', -// 'unsigned' => TRUE, -// 'not null' => TRUE, -// ), -// 'title' => array( -// 'type' => 'varchar', -// 'length' => 512, -// 'not null' => TRUE, -// ), -// 'default_nid' => array( -// 'type' => 'int', -// 'unsigned' => TRUE, -// 'not null' => FALSE, -// ), -// 'url' => array( -// 'type' => 'varchar', -// 'length' => 255, -// 'not null' => TRUE, -// ), -// 'destination_path' => array( -// 'type' => 'varchar', -// 'length' => 255, -// 'not null' => FALSE -// ), -// 'replacements' => array( -// 'type' => 'text', -// 'size' => 'normal', -// 'not null' => FALSE -// ), -// 'destination_redirect' => array( -// 'type' => 'int', -// 'unsigned' => TRUE, -// 'not null' => FALSE, -// ), -// 'admin_title' => array( -// 'type' => 'varchar', -// 'length' => 512, -// 'not null' => FALSE, -// ), -// ), -// 'primary key' => array('fid'), -// ); - -// $schema['fillpdf_fields'] = array( -// 'fields' => array( -// 'fid' => array( -// 'type' => 'int', -// 'unsigned' => TRUE, -// 'not null' => TRUE, -// ), -// 'pdf_key' => array( -// 'type' => 'varchar', -// 'length' => 255, -// 'not null' => TRUE, -// ), -// 'label' => array( -// 'type' => 'varchar', -// 'length' => 255, -// 'not null' => TRUE, -// ), -// 'prefix' => array( -// 'type' => 'varchar', -// 'length' => 4096, -// 'not null' => FALSE, -// ), -// 'value' => array( -// 'type' => 'text', -// 'size' => 'medium', -// 'not null' => TRUE, -// ), -// 'suffix' => array( -// 'type' => 'varchar', -// 'length' => 4096, -// 'not null' => FALSE, -// ), -// 'replacements' => array( -// 'type' => 'text', -// 'size' => 'normal', -// 'not null' => FALSE, -// ), -// ), -// 'primary key' => array('fid', 'pdf_key'), -// ); - - return $schema; -} - -///** -// * Implements hook_update_N(). -// */ -// -///** -// * Add field to store destination path for saving PDFs as files. -// */ -//function fillpdf_update_7001() { -// if (!db_field_exists('fillpdf_forms', 'destination_path')) { -// db_add_field('fillpdf_forms', 'destination_path', array('type' => 'varchar', 'length' => 255, 'not null' => FALSE)); -// } -//} -// -///** -// * Add fields to store token replacements. -// */ -//function fillpdf_update_7002() { -// if (!db_field_exists('fillpdf_forms', 'replacements')) { -// db_add_field('fillpdf_forms', 'replacements', array('type' => 'text', 'size' => 'normal', 'not null' => FALSE)); -// } -// if (!db_field_exists('fillpdf_fields', 'replacements')) { -// db_add_field('fillpdf_fields', 'replacements', array('type' => 'text', 'size' => 'normal', 'not null' => FALSE)); -// } -//} -// -///** -// * Convert legacy configuration variables to new fillpdf_service variable and delete. -// */ -//function fillpdf_update_7003() { -// $default = FALSE; -// global $conf; -// foreach (array('fillpdf_remote_service', 'fillpdf_local_service', 'fillpdf_local_php') as $variable_name) { -// if (isset($conf[$variable_name])) { -// if ($conf[$variable_name]) { -// $default = $variable_name; -// } -// variable_del($variable_name); -// } -// } -// if ($default) { -// $variable_name_map = array( -// 'fillpdf_local_php' => 'pdftk', -// 'fillpdf_local_service' => 'local', -// 'fillpdf_remote_service' => 'remote', -// ); -// variable_set('fillpdf_service', $variable_name_map[$default]); -// } -//} -// -///** -// * Add field to store default NID. -// */ -//function fillpdf_update_7004() { -// if (!db_field_exists('fillpdf_forms', 'default_nid')) { -// db_add_field('fillpdf_forms', 'default_nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE)); -// } -//} -// -///** -// * Add database field to hold "Redirect to saved file" setting. -// */ -//function fillpdf_update_7005() { -// if (!db_field_exists('fillpdf_forms', 'destination_redirect')) { -// db_add_field('fillpdf_forms', 'destination_redirect', array('type' => 'int', 'size' => 'tiny', 'unsigned' => TRUE, 'not null' => FALSE)); -// } -//} -// -///** -// * Add database fields for prefix and suffix. -// */ -//function fillpdf_update_7006() { -// $schema = drupal_get_schema_unprocessed('fillpdf', 'fillpdf_fields'); -// if (!db_field_exists('fillpdf_fields', 'prefix')) { -// db_add_field('fillpdf_fields', 'prefix', $schema['fields']['prefix']); -// } -// if (!db_field_exists('fillpdf_fields', 'suffix')) { -// db_add_field('fillpdf_fields', 'suffix', $schema['fields']['suffix']); -// } -//} -// -///** -// * Add administrative title; make title longer. -// */ -//function fillpdf_update_7101() { -// $schema = drupal_get_schema_unprocessed('fillpdf', 'fillpdf_forms'); -// if (!db_field_exists('fillpdf_forms', 'admin_title')) { -// db_add_field('fillpdf_forms', 'admin_title', $schema['fields']['admin_title']); -// } -// -// db_change_field('fillpdf_forms', 'title', 'title', $schema['fields']['title']); -//} diff --git a/src/FillPdfFormViewsData.php b/src/FillPdfFormViewsData.php index b956d39..f1af79c 100644 --- a/src/FillPdfFormViewsData.php +++ b/src/FillPdfFormViewsData.php @@ -16,7 +16,7 @@ class FillPdfFormViewsData extends EntityViewsData { public function getViewsData() { $data = parent::getViewsData(); - $data['fillpdf_forms']['table']['group'] = t('FillPDF forms'); + $data['fillpdf_forms']['table']['group'] = $data['fillpdf_forms']['table']['base']['title'] = t('FillPDF forms'); $data['fillpdf_forms']['table']['base']['help'] = t('FillPDF forms are uploaded on the FillPDF administration page and are used by the FillPDF module.'); diff --git a/src/Form/FillPdfOverviewForm.php b/src/Form/FillPdfOverviewForm.php index 4e3e797..beb9a5c 100644 --- a/src/Form/FillPdfOverviewForm.php +++ b/src/Form/FillPdfOverviewForm.php @@ -79,48 +79,8 @@ class FillPdfOverviewForm extends FillPdfAdminFormBase { * The form structure. */ public function buildForm(array $form, FormStateInterface $form_state) { - // @todo: Convert to using data from entity or something. - $result_ids = $this->entityQuery->get('fillpdf_form') - ->execute(); - - $header = array( - $this->t('Administrative title'), - $this->t('Title'), - $this->t('Location'), - array( - 'data' => t('Operations'), - 'colspan' => '4', - ), - ); - $rows = array(); - $form['existing_forms'] = array( - '#theme' => 'table', - '#header' => $header, - '#attributes' => array('id' => 'fillpdf'), - '#empty' => $this->t('No content available.'), - ); - - $result = array(); - if ($result_ids) { - $result = FillPdfForm::loadMultiple($result_ids); - } - - foreach ($result as $pdf_form) { - $row = array( - String::checkPlain($pdf_form->admin_title->value), - String::checkPlain($pdf_form->title->value), - String::checkPlain(File::load($pdf_form->file->target_id)->uri->value), - // @todo: Convert to routes. -// $this->l($this->t('Edit'), "admin/structure/fillpdf/$pdf_form->fid"), -// $this->l($this->t('Delete'), "admin/structure/fillpdf/$pdf_form->fid/delete"), -// $this->l($this->t('Export field mappings'), "admin/structure/fillpdf/$pdf_form->fid/export"), -// $this->l($this->t('Import field mappings'), "admin/structure/fillpdf/$pdf_form->fid/import"), - ); - - $rows[] = $row; - } - - $form['existing_forms']['#rows'] = $rows; + // @todo: convert to OOP + $form['existing_forms'] = views_embed_view('fillpdf_forms', 'block_1'); $config = $this->config('fillpdf.settings'); // Only show PDF upload form if fillpdf is configured. @@ -179,7 +139,6 @@ class FillPdfOverviewForm extends FillPdfAdminFormBase { 'uid' => $this->currentUser()->id(), )); - // TODO: test this $errors = file_validate_extensions($new_file, 'pdf'); if (!empty($errors)) { -- GitLab