Skip to content

[docs] Provide full example for Forms API #1351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/apis/subsystems/form/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ To create a form in Moodle, you create a class that defines the form, including
<summary>An example of a form definition</summary>

```php title="[path/to/plugin]/classes/form/myform.php"
<?php

namespace [plugintype]_[pluginname]\form;

// moodleform is defined in formslib.php
require_once("$CFG->libdir/formslib.php");

class simplehtml_form extends moodleform {
class simplehtml_form extends \moodleform {
// Add elements to form.
public function definition() {
// A reference to the form is stored in $this->form.
Expand Down
6 changes: 5 additions & 1 deletion versioned_docs/version-4.1/apis/subsystems/form/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ To create a form in Moodle, you create a class that defines the form, including
<summary>An example of a form definition</summary>

```php title="[path/to/plugin]/classes/form/myform.php"
<?php

namespace [plugintype]_[pluginname]\form;

// moodleform is defined in formslib.php
require_once("$CFG->libdir/formslib.php");

class simplehtml_form extends moodleform {
class simplehtml_form extends \moodleform {
// Add elements to form.
public function definition() {
// A reference to the form is stored in $this->form.
Expand Down
6 changes: 5 additions & 1 deletion versioned_docs/version-4.4/apis/subsystems/form/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ To create a form in Moodle, you create a class that defines the form, including
<summary>An example of a form definition</summary>

```php title="[path/to/plugin]/classes/form/myform.php"
<?php

namespace [plugintype]_[pluginname]\form;

// moodleform is defined in formslib.php
require_once("$CFG->libdir/formslib.php");

class simplehtml_form extends moodleform {
class simplehtml_form extends \moodleform {
// Add elements to form.
public function definition() {
// A reference to the form is stored in $this->form.
Expand Down
6 changes: 5 additions & 1 deletion versioned_docs/version-4.5/apis/subsystems/form/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ To create a form in Moodle, you create a class that defines the form, including
<summary>An example of a form definition</summary>

```php title="[path/to/plugin]/classes/form/myform.php"
<?php

namespace [plugintype]_[pluginname]\form;

// moodleform is defined in formslib.php
require_once("$CFG->libdir/formslib.php");

class simplehtml_form extends moodleform {
class simplehtml_form extends \moodleform {
// Add elements to form.
public function definition() {
// A reference to the form is stored in $this->form.
Expand Down
6 changes: 5 additions & 1 deletion versioned_docs/version-5.0/apis/subsystems/form/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ To create a form in Moodle, you create a class that defines the form, including
<summary>An example of a form definition</summary>

```php title="[path/to/plugin]/classes/form/myform.php"
<?php

namespace [plugintype]_[pluginname]\form;

// moodleform is defined in formslib.php
require_once("$CFG->libdir/formslib.php");

class simplehtml_form extends moodleform {
class simplehtml_form extends \moodleform {
// Add elements to form.
public function definition() {
// A reference to the form is stored in $this->form.
Expand Down