Skip to content

Commit

Permalink
feat: Add hooks for adding header/footer html to index and edit Defau…
Browse files Browse the repository at this point in the history
…ltController pages
  • Loading branch information
hellopablo committed Oct 7, 2024
1 parent a15a522 commit 306c26e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions admin/views/DefaultController/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@
<div class="group-defaultcontroller edit" <?=$CONFIG['EDIT_PAGE_ID'] ? 'id="' . $CONFIG['EDIT_PAGE_ID'] . '"' : ''?>>
<?php

echo $CONFIG['EDIT_HTML_HEADER'];
echo form_open();
echo Helper::tabs($aTabs);
echo Helper::floatingControls($CONFIG['FLOATING_CONFIG']);
echo form_close();
echo $CONFIG['EDIT_HTML_HEADER'];

?>
</div>
2 changes: 2 additions & 0 deletions admin/views/DefaultController/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

?>
<div class="group-defaultcontroller browse" <?=$CONFIG['INDEX_PAGE_ID'] ? 'id="' . $CONFIG['INDEX_PAGE_ID'] . '"' : ''?>>
<?=$CONFIG['INDEX_HTML_HEADER']?>
<?=Helper::loadSearch($search)?>
<?=Helper::loadPagination($pagination)?>
<table class="table table-striped table-hover table-bordered table-responsive">
Expand Down Expand Up @@ -309,4 +310,5 @@
</tbody>
</table>
<?=Helper::loadPagination($pagination)?>
<?=$CONFIG['INDEX_HTML_FOOTER']?>
</div>
24 changes: 24 additions & 0 deletions src/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,16 @@ abstract class DefaultController extends Base
*/
const CONFIG_INDEX_NOTES_COUNT = false;

/**
* Any additional markup to include at the head of the index page
*/
const CONFIG_INDEX_HTML_HEADER = '';

/**
* Any additional markup to include at the foot of the index page
*/
const CONFIG_INDEX_HTML_FOOTER = '';

/**
* Fields which should be marked as readonly when creating an item
*/
Expand Down Expand Up @@ -312,6 +322,16 @@ abstract class DefaultController extends Base
*/
const CONFIG_EDIT_NOTES_ENABLE = true;

/**
* Any additional markup to include at the head of the edit page
*/
const CONFIG_EDIT_HTML_HEADER = '';

/**
* Any additional markup to include at the foot of the edit page
*/
const CONFIG_EDIT_HTML_FOOTER = '';

/**
* Additional data to pass into the getAll call on the delete view
*/
Expand Down Expand Up @@ -1344,6 +1364,8 @@ protected function &getConfig(): array
'INDEX_PAGE_ID' => static::CONFIG_INDEX_PAGE_ID,
'INDEX_NOTES_ENABLE' => static::CONFIG_INDEX_NOTES_ENABLE,
'INDEX_NOTES_COUNT' => static::CONFIG_INDEX_NOTES_COUNT,
'INDEX_HTML_HEADER' => static::CONFIG_INDEX_HTML_HEADER,
'INDEX_HTML_FOOTER' => static::CONFIG_INDEX_HTML_FOOTER,
'CREATE_READONLY_FIELDS' => static::CONFIG_CREATE_READONLY_FIELDS,
'CREATE_IGNORE_FIELDS' => static::CONFIG_CREATE_IGNORE_FIELDS,
'EDIT_HEADER_BUTTONS' => static::CONFIG_EDIT_HEADER_BUTTONS,
Expand All @@ -1352,6 +1374,8 @@ protected function &getConfig(): array
'EDIT_DATA' => static::CONFIG_EDIT_DATA,
'EDIT_PAGE_ID' => static::CONFIG_EDIT_PAGE_ID,
'EDIT_NOTES_ENABLE' => static::CONFIG_EDIT_NOTES_ENABLE,
'EDIT_HTML_HEADER' => static::CONFIG_EDIT_HTML_HEADER,
'EDIT_HTML_FOOTER' => static::CONFIG_EDIT_HTML_FOOTER,
'DELETE_DATA' => static::CONFIG_DELETE_DATA,
'SORT_DATA' => static::CONFIG_SORT_DATA,
'SORT_LABEL' => static::CONFIG_SORT_LABEL,
Expand Down

0 comments on commit 306c26e

Please sign in to comment.