Okay
  Public Ticket #2015220
Edit Modal
Closed

Comments

  • jb11294 started the conversation

    Hello,

    Is it possible to change the text of the popover edit block text from edit to view, as well as modify the modal form so the editable text in there is only view only.

  •  2,507
    Aleksandar replied

    Hello jb11294.

    Thank you for your purchase.

    To change the text for "Edit", "New" and "Delete" buttons, you can open wp-content/plugins/wpdatatables/source/class.wpdatatable.php around line 3257 find this line of code:

    array(
        'text' => __('New entry', 'wpdatatables'),
        'className' => 'new_table_entry DTTT_button DTTT_button_new'
    ),
    array(
        'text' => __('Edit', 'wpdatatables'),
        'className' => 'edit_table DTTT_button DTTT_button_edit',
        'enabled' => false
    ),
    array(
        'text' => __('Delete', 'wpdatatables'),
        'className' => 'delete_table_entry DTTT_button DTTT_button_delete',
        'enabled' => false

    And after 'text' => you can change 'Edit' to whatever you want. Same goes for 'New Entry' and 'Delete' of course.

    As for leaving the text in 'view-only' mode is not something so easily done, and would fall under customization of the plugin, since the feature is not built-in out-of-the-box. You're welcome to explore ../wp-content/plugins/wpdatatables/templates/frontend/edit_dialog.inc.php and maybe you'll find what you need there. I can't say if there's any other file that needs to be modified, because we haven't done anything like this yet.

    Best regards.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • jb11294 replied

    Hello Aleksandar,

    Thank you! i just was not sure what file to look through.

    So i discovered in the edit_diaglog.inc file that you directed me to if you are only looking for read-only access (without using an edit model at all) you can just apply  readonly  to the textarea around line 59  and to where the code decides whether to use float, date,time, or datetime as well around line 134 fields to prevent it from being edited without having to redesign anything. I couldn't find the integer field code to make it not editable, but if you make any integer column in a table to string, it will make it view only.

    Line 59 Area

    <textarea data-input_type="<?php echo $dataColumn->getInputType(); ?>" 
                                  class="form-control editDialogInput <?php if ($dataColumn->isNotNull()) { ?>mandatory<?php } ?> <?php if ($dataColumn->getInputType() == 'mce-editor') { ?>wpdt-tiny-mce<?php } ?>"
                                  id="<?php echo $this->getId() ?>_<?php echo $dataColumn_key ?>"
                                  data-key="<?php echo $dataColumn_key ?>" rows="5"
                                  data-column_header="<?php echo $dataColumn->getTitle(); ?>" readonly></textarea>

    Line 134 Area

             class="form-control input-sm editDialogInput
                                            <?php if ($dataColumn->isNotNull()) { ?>mandatory<?php } ?>
                                            <?php if ($dataColumn->getDataType() == 'float' || $dataColumn->getDataType() == 'int') { ?>wdt-maskmoney<?php } ?>
                                            <?php if ($dataColumn->getInputType() == 'date') { ?>wdt-datepicker<?php } ?>
                                            <?php if ($dataColumn->getInputType() == 'time') { ?>wdt-timepicker<?php } ?>
                                            <?php if ($dataColumn->getInputType() == 'datetime') { ?>wdt-datetimepicker<?php } ?>" readonly
                        />

    Then in the class.wdttools.php change around line 364 'Edit entry' to 'View Entry'

      'dataSaved' => __('Data has been saved!', 'wpdatatables'),

                'detach_file' => __('detach', 'wpdatatables'),
                'edit_entry' => __('View Entry', 'wpdatatables'),
                'error' => __('Error!', 'wpdatatables'),

  •  2,507
    Aleksandar replied

    Hey jb11294.

    Great work, I must say! And thanks for this. It may help someone else if they come up with the same request. Greatly appreciated!

    Best regards.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables