Add callback before edit form (bug #759)

This commit is contained in:
Jakub Vrana 2021-02-08 09:23:57 +01:00
parent 2dd3bd0e1a
commit a8c218f192
4 changed files with 21 additions and 4 deletions

View file

@ -480,7 +480,7 @@ class Adminer {
echo "</script>\n";
echo "</div></fieldset>\n";
}
/** Print command box in select
* @return bool whether to print default commands
*/
@ -659,6 +659,16 @@ class Adminer {
;
}
/** Print before edit form
* @param string
* @param array
* @param mixed
* @param bool
* @return null
*/
function editRowPrint($table, $fields, $row, $update) {
}
/** Functions displayed in edit form
* @param array single field from fields()
* @return array

View file

@ -1411,15 +1411,16 @@ function on_help($command, $side = 0) {
* @param bool
* @return null
*/
function edit_form($TABLE, $fields, $row, $update) {
function edit_form($table, $fields, $row, $update) {
global $adminer, $jush, $token, $error;
$table_name = $adminer->tableName(table_status1($TABLE, true));
$table_name = $adminer->tableName(table_status1($table, true));
page_header(
($update ? lang('Edit') : lang('Insert')),
$error,
array("select" => array($TABLE, $table_name)),
array("select" => array($table, $table_name)),
$table_name
);
$adminer->editRowPrint($table, $fields, $row, $update);
if ($row === false) {
echo "<p class='error'>" . lang('No rows.') . "\n";
}

View file

@ -452,6 +452,9 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
return " <span class='time'>" . @date("H:i:s") . "</span><!--\n" . str_replace("--", "--><!-- ", $query) . "\n" . ($time ? "($time)\n" : "") . "-->";
}
function editRowPrint($table, $fields, $row, $update) {
}
function editFunctions($field) {
$return = array();
if ($field["null"] && preg_match('~blob~', $field["type"])) {

View file

@ -83,6 +83,9 @@ class AdminerPlugin extends Adminer {
return $this->_appendPlugin(__FUNCTION__, $args);
}
function editRowPrint($table, $fields, $row, $update) {
}
function editFunctions($field) {
$args = func_get_args();
return $this->_appendPlugin(__FUNCTION__, $args);