From b64e4878c4c4af8c1e732c46bd51b7f1f5427a1b Mon Sep 17 00:00:00 2001 From: Tony Air Date: Mon, 28 Jun 2021 13:20:02 +0200 Subject: [PATCH] IMPR: GridField Inline editor config --- README.md | 24 +++++++- .../GridField/GridFieldConfig_Inline.php | 59 +++++++++++++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 src/Forms/GridField/GridFieldConfig_Inline.php diff --git a/README.md b/README.md index 0638e0b..f456c64 100644 --- a/README.md +++ b/README.md @@ -1 +1,23 @@ -# cms-niceties \ No newline at end of file +# cms-niceties +Some useful CMS objects and extensions + +## Usefull UNIX console utilities + +### Code search (find . -name "*.*" | xargs grep "some text" replacement) + +ag "some text" ./ +https://github.com/ggreer/the_silver_searcher + +### File content with code hightlighting (cat replacement) + +bat ./app/src/Pages/Page.php +https://github.com/sharkdp/bat + +### File listing (ls replacement) + +exa -aTL3 ./app +https://github.com/ogham/exa + +### git diff tool with bat code hightlighting (git show) + +https://github.com/dandavison/delta \ No newline at end of file diff --git a/src/Forms/GridField/GridFieldConfig_Inline.php b/src/Forms/GridField/GridFieldConfig_Inline.php new file mode 100644 index 0000000..f217715 --- /dev/null +++ b/src/Forms/GridField/GridFieldConfig_Inline.php @@ -0,0 +1,59 @@ +addComponent(new GridFieldTitleHeader()) + ->addComponent(new GridFieldEditableColumns()); + + if($showDetails) { + $this + ->addComponent(new GridFieldDetailForm(null, true, $showAdd)) + ->addComponent(new GridFieldEditButton()); + } + + $this + ->addComponent($pagination = new GridFieldPaginator($itemsPerPage)) + ->addComponent($filter = new GridFieldFilterHeader()) + ->addComponent(new GridFieldPageCount('toolbar-header-right')) + ->addComponent(new GridFieldButtonRow('before')) + ->addComponent(new GridFieldToolbarHeader()) + ->addComponent(new GridFieldDeleteAction()); + + if($showAdd) { + $this->addComponent(new GridFieldAddNewInlineButton()); + } + + $pagination->setThrowExceptionOnBadDataType(false); + $filter->setThrowExceptionOnBadDataType(false); + + $this->extend('updateConfig'); + } +} \ No newline at end of file