Skip to content

Commit 443267e

Browse files
committed
Change documentation to reflect 'datakit/loaded' hook
1 parent 81d72dd commit 443267e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

docs/docs/Plugin/getting-started.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ To install the WordPress plugin, follow these instructions:
1414
```bash
1515
git clone [email protected]:GravityKit/DataKit.git DataKit
1616
```
17-
17+
1818
2. Symlink your repository to your WordPress' `wp-content/plugins` folder (Not required if you cloned it there directly)
1919
2020
```bash
@@ -24,13 +24,22 @@ To install the WordPress plugin, follow these instructions:
2424
2525
3. Go into the folder and perform a Composer install
2626
```bash
27-
composer install --no-dev -o
27+
composer install --no-dev
2828
```
2929
3030
4. Go to your WordPress installation, and activate the DataKit plugin.
3131
3232
## Creating a DataView
3333
34+
In order to register the DataView, you need to wait until the `datakit/loaded` action hook was dispatched. After this,
35+
you can be certain DataKit was loaded and the default data sources and fields are available to use.
36+
37+
```php
38+
add_action( 'datakit/loaded', function () {
39+
// Create your DataView here.
40+
} );
41+
```
42+
3443
DataKit provides a fluent PHP API for creating `DataView` objects. A `DataView` consists of a `DataSource` and a set of
3544
`Fields`. To learn more about the different field types, please see our [Documentation](SDK/Fields/using-fields).
3645
@@ -61,4 +70,5 @@ DataKit provides a fluent PHP API for creating `DataView` objects. A `DataView`
6170
```php
6271
do_action( 'datakit/dataview/register', $dataview );
6372
```
64-
4. Show off your `DataView`! You can use the `[dataview id="my-dataview"]` shortcode to display your `DataView` anywhere.
73+
4. Show off your `DataView`! You can use the `[dataview id="my-dataview"]` shortcode to display your `DataView`
74+
anywhere.

0 commit comments

Comments
 (0)