Skip to content

tutorial for developping a plugin#166

Merged
trasher merged 35 commits intomasterfrom
feat/plugin_dev_tutorial
Feb 7, 2025
Merged

tutorial for developping a plugin#166
trasher merged 35 commits intomasterfrom
feat/plugin_dev_tutorial

Conversation

@orthagh
Copy link
Contributor

@orthagh orthagh commented Jan 29, 2025

TODO:

  • translate
  • make up to date advises ^^

@trasher trasher force-pushed the feat/plugin_dev_tutorial branch from a09e3e3 to adc0a7f Compare January 30, 2025 13:09
Copy link
Contributor

@cconard96 cconard96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a complete review

function plugin_init_myplugin() {
global $PLUGIN_HOOKS;

$PLUGIN_HOOKS['csrf_compliant']['myplugin'] = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$PLUGIN_HOOKS['csrf_compliant']['myplugin'] = true;
$PLUGIN_HOOKS['csrf_compliant']['myplugin'] = true;

This hook doesn't exist anymore as far as I know. All plugins are expected to handle CSRF.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been removed in GLPI v11, but seems still present on v10.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I keep this one open for reference when working on the GLPI v11 version


This instanciation function is important, we will declare later here `Hooks` on GLPI internal API.
It's systematically called on **all** GLPI pages except if the ``_check_prerequisites`` fails (see below).
We declare here that our plugin forms are `CSRF <https://en.wikipedia.org/wiki/Cross-Site_Request_Forgery>`_ compliant even if for now our plugin does not contain any form.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not valid anymore?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I keep this one open for reference when working on the GLPI v11 version

trasher and others added 3 commits February 4, 2025 21:03
Thanks Curtis!

Co-authored-by: Curtis Conard <cconard96@gmail.com>
Co-authored-by: Curtis Conard <cconard96@gmail.com>
@orthagh orthagh marked this pull request as ready for review February 5, 2025 08:25
Co-authored-by: Curtis Conard <cconard96@gmail.com>
trasher and others added 2 commits February 7, 2025 06:54
Co-authored-by: Alexandre Delaunay <delaunay.alexandre@gmail.com>
@trasher trasher merged commit 03cf65a into master Feb 7, 2025
1 check passed
trasher added a commit that referenced this pull request Feb 7, 2025
* tutorial for developping a plugin

* update doc

* Fix syntax

* clean php snippets

* clean use

* clean use

* Few fixes

* Fix doc links

* Translate titles

* Rework main title

* Translation

* Dead ref

* Translate

* Remove metabase part

* Translate

* Fix internal links

* Apply suggestions from code review

Co-authored-by: Curtis Conard <cconard96@gmail.com>

* Work on translations

* Maybe should not we use logDebug.

* Translation, minor fix

* Fix syntax

* Translate

* Translate

* Translate

* No direct querying

* End translation

* Typo

* Typos, misssed translations

* Apply suggestions from code review

Thanks Curtis!

Co-authored-by: Curtis Conard <cconard96@gmail.com>

* Update source/plugins/tutorial.rst

Co-authored-by: Curtis Conard <cconard96@gmail.com>

* A word about npm. Precision: composer and npm are not mandatory

* Apply suggestions from code review

Co-authored-by: Curtis Conard <cconard96@gmail.com>

* Add download_url and a note on plugin submission URL

* Apply suggestions from code review

Co-authored-by: Alexandre Delaunay <delaunay.alexandre@gmail.com>

* Replace old links

---------

Co-authored-by: Johan Cwiklinski <johan@x-tnd.be>
Co-authored-by: Curtis Conard <cconard96@gmail.com>
@trasher trasher deleted the feat/plugin_dev_tutorial branch February 7, 2025 08:13
cedric-anne pushed a commit that referenced this pull request May 19, 2025
* tutorial for developping a plugin

* update doc

* Fix syntax

* clean php snippets

* clean use

* clean use

* Few fixes

* Fix doc links

* Translate titles

* Rework main title

* Translation

* Dead ref

* Translate

* Remove metabase part

* Translate

* Fix internal links

* Apply suggestions from code review

Co-authored-by: Curtis Conard <cconard96@gmail.com>

* Work on translations

* Maybe should not we use logDebug.

* Translation, minor fix

* Fix syntax

* Translate

* Translate

* Translate

* No direct querying

* End translation

* Typo

* Typos, misssed translations

* Apply suggestions from code review

Thanks Curtis!

Co-authored-by: Curtis Conard <cconard96@gmail.com>

* Update source/plugins/tutorial.rst

Co-authored-by: Curtis Conard <cconard96@gmail.com>

* A word about npm. Precision: composer and npm are not mandatory

* Apply suggestions from code review

Co-authored-by: Curtis Conard <cconard96@gmail.com>

* Add download_url and a note on plugin submission URL

* Apply suggestions from code review

Co-authored-by: Alexandre Delaunay <delaunay.alexandre@gmail.com>

* Replace old links

---------

Co-authored-by: Johan Cwiklinski <johan@x-tnd.be>
Co-authored-by: Curtis Conard <cconard96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants