-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Update widgets.md #14
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,6 @@ callout: This section is incomplete. Please help to improve it. | |
|
||
## Defining a generic widget | ||
|
||
### Widget class | ||
|
||
## Defining a form widget | ||
|
||
### Form widget class | ||
|
@@ -20,13 +18,93 @@ callout: This section is incomplete. Please help to improve it. | |
### Form widget registration | ||
|
||
## Defining a dashboard widget | ||
First Create your Extension | ||
https://tastyigniter.com/docs/master/extend/extensions | ||
|
||
Extension.php | ||
``` | ||
public function extensionMeta() | ||
{ | ||
return [ | ||
'name' => 'My Widget Extension', | ||
'author' => 'Docs', | ||
'description' => 'No description provided yet...', | ||
'icon' => 'fa-plug', | ||
'version' => '1.0.0' | ||
]; | ||
} | ||
|
||
|
||
public function registerDashboardWidgets() { | ||
|
||
return [ | ||
'TastyExt\PluginName\ControllerPath' => [ | ||
'label' => 'Name Of Widget', | ||
'context' => 'My Content', | ||
], | ||
|
||
|
||
]; | ||
|
||
} | ||
``` | ||
|
||
### Dashboard widget class | ||
```use Admin\Classes\BaseDashboardWidget; | ||
class ControllerPath extends BaseDashboardWidget | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a descriptive name.. |
||
{ | ||
|
||
/** | ||
* @var string A unique alias to identify this widget. | ||
*/ | ||
protected $defaultAlias = 'PluginName'; | ||
|
||
public function render() | ||
{ | ||
$this->prepareVars(); | ||
|
||
return $this->makePartial('partials/quicklinks'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be |
||
/* This would be your blade file with to display your html */ | ||
} | ||
|
||
public function defineProperties() | ||
{ | ||
return [ | ||
'title' => [ | ||
'label' => 'Property One', | ||
'default' => 'test', | ||
'type' => 'text', | ||
] | ||
]; | ||
} | ||
|
||
protected function prepareVars() | ||
{ | ||
|
||
$this->vars['exampleVar'] = "Some Var"; | ||
} | ||
|
||
} | ||
``` | ||
|
||
## Adding Content to Widget | ||
|
||
|
||
Inside | ||
partials/myblade.blade.php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
|
||
You can then display any html code you like. | ||
|
||
<a href="MyLink"> My Link in my Widget </a> | ||
|
||
|
||
|
||
You can now go to your Dashboard and select your widget from the drop down. | ||
|
||
### Dashboard widget properties | ||
|
||
### Dashboard widget registration | ||
|
||
## AJAX handlers | ||
|
||
## | ||
## |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not required.