Skip to content

Commit de92ffd

Browse files
committed
refacto hello_world to helloworld
1 parent b1a1dad commit de92ffd

File tree

8 files changed

+41
-41
lines changed

8 files changed

+41
-41
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ That was it ! You can now add a hello world block.
1414
Connect as an admin and add a "hello world" block. Once added, you can configure your block settings.
1515

1616
### Global configuration
17-
* The global configuration of the block is available at : *https://localhost/admin/settings.php?section=blocksettinghello_world*
17+
* The global configuration of the block is available at : *https://localhost/admin/settings.php?section=blocksettinghelloworld*
1818

1919
## Ressources
2020
* [Moodle programming course](https://www.youtube.com/playlist?list=PLgfLVzXXIo5q10qVXDVyD-JZVyZL9pCq0)

block_hello_world.php renamed to block_helloworld.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@
1919
/**
2020
* a basic hello world block plugin
2121
* @package block
22-
* @subpackage hello_world
22+
* @subpackage helloworld
2323
* @copyright 2017 benIT
2424
* @author benIT <benoit.works@gmail.com>
2525
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2626
*/
27-
class block_hello_world extends block_base
27+
class block_helloworld extends block_base
2828
{
2929
/**
3030
* block initializations
3131
*/
3232
public function init()
3333
{
34-
$this->title = get_string('pluginname', 'block_hello_world');
34+
$this->title = get_string('pluginname', 'block_helloworld');
3535
}
3636

3737
/**
@@ -55,14 +55,14 @@ public function specialization()
5555
{
5656
if ($this->config) {
5757
//let's set up the block title
58-
$this->title = $this->config->title ? $this->config->title : get_string('hello_world:defaultblocktitle', 'block_hello_world');
58+
$this->title = $this->config->title ? $this->config->title : get_string('helloworld:defaultblocktitle', 'block_helloworld');
5959
}
6060
}
6161

6262
public function html_attributes()
6363
{
6464
$attributes = parent::html_attributes();
65-
if (get_config('hello_world', 'Colored_Text')) {
65+
if (get_config('helloworld', 'Colored_Text')) {
6666
$attributes['class'] .= ' colored-text';
6767
}
6868
return $attributes;

db/access.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* hello world block plugin capabilities
1919
* @package block
20-
* @subpackage hello_world
20+
* @subpackage helloworld
2121
* @copyright 2017
2222
* @author benIT <benoit.works@gmail.com>
2323
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -26,7 +26,7 @@
2626

2727
$capabilities = array(
2828

29-
'block/hello_world:myaddinstance' => array(
29+
'block/helloworld:myaddinstance' => array(
3030
'captype' => 'write',
3131
'contextlevel' => CONTEXT_SYSTEM,
3232
'archetypes' => array(
@@ -36,7 +36,7 @@
3636
'clonepermissionsfrom' => 'moodle/my:manageblocks'
3737
),
3838

39-
'block/hello_world:addinstance' => array(
39+
'block/helloworld:addinstance' => array(
4040
'riskbitmask' => RISK_SPAM | RISK_XSS,
4141

4242
'captype' => 'write',

edit_form.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
/**
1818
* configuration form of hello world block
1919
* @package block
20-
* @subpackage hello_world
20+
* @subpackage helloworld
2121
* @copyright 2017 benIT
2222
* @author benIT <benoit.works@gmail.com>
2323
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2424
*/
25-
class block_hello_world_edit_form extends block_edit_form
25+
class block_helloworld_edit_form extends block_edit_form
2626
{
2727

2828
protected function specific_definition($mform)
@@ -32,11 +32,11 @@ protected function specific_definition($mform)
3232
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
3333

3434
// A sample string variable with a default value.
35-
$mform->addElement('text', 'config_text', get_string('hello_world:contentinputlabel', 'block_hello_world'));
35+
$mform->addElement('text', 'config_text', get_string('helloworld:contentinputlabel', 'block_helloworld'));
3636
$mform->setDefault('config_text', 'default value');
3737
$mform->setType('config_text', PARAM_RAW);
3838

39-
$mform->addElement('text', 'config_title', get_string('hello_world:titleinputlabel', 'block_hello_world'));
39+
$mform->addElement('text', 'config_title', get_string('helloworld:titleinputlabel', 'block_helloworld'));
4040
$mform->setDefault('config_title', 'default value');
4141
$mform->setType('config_title', PARAM_TEXT);
4242

lang/en/block_hello_world.php renamed to lang/en/block_helloworld.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616
/**
1717
* en language file
1818
* @package block
19-
* @subpackage hello_world
19+
* @subpackage helloworld
2020
* @copyright 2017 benIT
2121
* @author benIT <benoit.works@gmail.com>
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323
*/
2424
$string['pluginname'] = 'hello world';
25-
$string['hello_world:addinstance'] = 'Add a hello world block';
26-
$string['hello_world:myaddinstance'] = 'Add a hello world block to Dashboard';
27-
$string['hello_world:contentinputlabel'] = 'Hello world block content';
28-
$string['hello_world:titleinputlabel'] = 'Hello world block title';
29-
$string['hello_world:defaultblocktitle'] = 'Hello world default title';
30-
$string['hello_world:headerconfig'] = 'Hello world global configuration';
31-
$string['hello_world:descconfig'] = 'Here is the global configuration of the hello world block';
32-
$string['hello_world:labelcoloredtext'] = 'Colored text ?';
33-
$string['hello_world:desccoloredtext'] = 'This will enabled a colored text for the block';
25+
$string['helloworld:addinstance'] = 'Add a hello world block';
26+
$string['helloworld:myaddinstance'] = 'Add a hello world block to Dashboard';
27+
$string['helloworld:contentinputlabel'] = 'Hello world block content';
28+
$string['helloworld:titleinputlabel'] = 'Hello world block title';
29+
$string['helloworld:defaultblocktitle'] = 'Hello world default title';
30+
$string['helloworld:headerconfig'] = 'Hello world global configuration';
31+
$string['helloworld:descconfig'] = 'Here is the global configuration of the hello world block';
32+
$string['helloworld:labelcoloredtext'] = 'Colored text ?';
33+
$string['helloworld:desccoloredtext'] = 'This will enabled a colored text for the block';

lang/fr/block_hello_world.php renamed to lang/fr/block_helloworld.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
/**
1717
* fr language file
1818
* @package block
19-
* @subpackage hello_world
19+
* @subpackage helloworld
2020
* @copyright 2017 benIT
2121
* @author benIT <benoit.works@gmail.com>
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323
*/
2424
$string['pluginname'] = 'hello world';
25-
$string['hello_world:addinstance'] = 'Ajouter un bloc hello world';
26-
$string['hello_world:myaddinstance'] = 'Ajouter un bloc hello world au dashboard';
27-
$string['hello_world:contentinputlabel'] = 'Contenu du bloc world';
28-
$string['hello_world:titleinputlabel'] = 'Titre du bloc world';
29-
$string['hello_world:defaultblocktitle'] = 'Titre par défaut du bloc world';
30-
$string['hello_world:headerconfig'] = 'Configuration globale du bloc hello world';
31-
$string['hello_world:descconfig'] = 'Configuration globale du bloc hello world';
32-
$string['hello_world:labelcoloredtext'] = 'Texte coloré ?';
33-
$string['hello_world:desccoloredtext'] = 'Active un texte coloré pour le bloc hello world';
25+
$string['helloworld:addinstance'] = 'Ajouter un bloc hello world';
26+
$string['helloworld:myaddinstance'] = 'Ajouter un bloc hello world au dashboard';
27+
$string['helloworld:contentinputlabel'] = 'Contenu du bloc world';
28+
$string['helloworld:titleinputlabel'] = 'Titre du bloc world';
29+
$string['helloworld:defaultblocktitle'] = 'Titre par défaut du bloc world';
30+
$string['helloworld:headerconfig'] = 'Configuration globale du bloc hello world';
31+
$string['helloworld:descconfig'] = 'Configuration globale du bloc hello world';
32+
$string['helloworld:labelcoloredtext'] = 'Texte coloré ?';
33+
$string['helloworld:desccoloredtext'] = 'Active un texte coloré pour le bloc hello world';
3434

settings.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* global settings for admin of hello world block plugin
1818
* @package block
19-
* @subpackage hello_world
19+
* @subpackage helloworld
2020
* @copyright 2017 benIT
2121
* @author benIT <benoit.works@gmail.com>
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -25,13 +25,13 @@
2525

2626
$settings->add(new admin_setting_heading(
2727
'headerconfig',
28-
get_string('hello_world:headerconfig', 'block_hello_world'),
29-
get_string('hello_world:descconfig', 'block_hello_world')
28+
get_string('helloworld:headerconfig', 'block_helloworld'),
29+
get_string('helloworld:descconfig', 'block_helloworld')
3030
));
3131

3232
$settings->add(new admin_setting_configcheckbox(
33-
'hello_world/Colored_Text',
34-
get_string('hello_world:labelcoloredtext', 'block_hello_world'),
35-
get_string('hello_world:desccoloredtext', 'block_hello_world'),
33+
'helloworld/Colored_Text',
34+
get_string('helloworld:labelcoloredtext', 'block_helloworld'),
35+
get_string('helloworld:desccoloredtext', 'block_helloworld'),
3636
'0'
3737
));

version.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* version file
44
* @package block
5-
* @subpackage hello_world
5+
* @subpackage helloworld
66
* @copyright 2017 benIT
77
* @author benIT <benoit.works@gmail.com>
88
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -11,4 +11,4 @@
1111

1212
$plugin->version = 2017031400; // The current plugin version (Date: YYYYMMDDXX)
1313
$plugin->requires = 2015111000; // Requires this Moodle version
14-
$plugin->component = 'block_hello_world'; // Full name of the plugin (used for diagnostics)
14+
$plugin->component = 'block_helloworld'; // Full name of the plugin (used for diagnostics)

0 commit comments

Comments
 (0)