-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Making websites with October CMS - Part 23 - Extending User Plugin
- Loading branch information
Ivan Doric
committed
Nov 21, 2016
1 parent
b98a765
commit 669474f
Showing
6 changed files
with
128 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php namespace Watchlearn\Profile; | ||
|
||
use System\Classes\PluginBase; | ||
use Rainlab\User\Controllers\Users as UsersController; | ||
|
||
class Plugin extends PluginBase | ||
{ | ||
public function registerComponents() | ||
{ | ||
} | ||
|
||
public function registerSettings() | ||
{ | ||
} | ||
|
||
public function boot(){ | ||
|
||
UsersController::extendFormFields(function($form, $model, $context){ | ||
$form->addTabFields([ | ||
'facebook' => [ | ||
'label' => 'Facebook', | ||
'type' => 'text', | ||
'tab' => 'Profile' | ||
], | ||
'bio' => [ | ||
'label' => 'Biography', | ||
'type' => 'textarea', | ||
'tab' => 'Profile' | ||
] | ||
]); | ||
}); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php return [ | ||
'plugin' => [ | ||
'name' => 'Profile', | ||
'description' => '' | ||
] | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
plugin: | ||
name: 'watchlearn.profile::lang.plugin.name' | ||
description: 'watchlearn.profile::lang.plugin.description' | ||
author: watchlearn | ||
icon: oc-icon-adjust | ||
homepage: '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php namespace Watchlearn\Profile\Updates; | ||
|
||
use Schema; | ||
use October\Rain\Database\Updates\Migration; | ||
|
||
class AddNewFields extends Migration | ||
{ | ||
|
||
public function up() | ||
{ | ||
Schema::table('users', function($table) | ||
{ | ||
$table->string('facebook')->nullable(); | ||
$table->text('bio')->nullable(); | ||
}); | ||
} | ||
|
||
public function down() | ||
{ | ||
$table->dropDown([ | ||
'facebook', | ||
'bio' | ||
]); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1.0.1: | ||
- Initialize plugin. | ||
- add_new_fields.php |