Skip to content

Commit f7ff089

Browse files
committed
document member fieldtype extension hooks
1 parent 850733e commit f7ff089

File tree

6 files changed

+66
-5
lines changed

6 files changed

+66
-5
lines changed

docs/add-ons/pro-variables/type.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Allows applying modifiers, which, among other, are used to apply [on-the-fly ima
6060

6161
## Grid
6262

63-
Uses the native [Grid field](/fieldtypes/grid.md). All native types are available, _except for Relationships_. To output the variable, use the `{exp:pro_variables:pair}` or `{exp:pro_variables:single}` tag where appropriate. You can use any of Grid’s [parameters](/fieldtypes/grid.md#parameters) and [variables](/fieldtypes/grid.ms#variables) using these tags. Additionally, one more parameter is available:
63+
Uses the native [Grid field](/fieldtypes/grid.md). All native types are available, _except for Relationships and Members_. To output the variable, use the `{exp:pro_variables:pair}` or `{exp:pro_variables:single}` tag where appropriate. You can use any of Grid’s [parameters](/fieldtypes/grid.md#parameters) and [variables](/fieldtypes/grid.ms#variables) using these tags. Additionally, one more parameter is available:
6464

6565
### Parameters
6666

docs/development/extension-hooks/extension-hooks-overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Core hooks are categorized into 5 categories:
2929
- [Output Library](development/extension-hooks/global/output.md)
3030
- [Pagination Library](development/extension-hooks/global/pagination.md)
3131
- [Relationships Fieldtype](development/extension-hooks/global/relationships.md)
32+
- [Members Fieldtype](development/extension-hooks/global/member-ft.md)
3233
- [Session Library](development/extension-hooks/global/session.md)
3334
- [Template Library](development/extension-hooks/global/template.md)
3435
- [Text Helper](development/extension-hooks/global/text-helper.md)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
lang: php
3+
---
4+
5+
<!--
6+
This source file is part of the open source project
7+
ExpressionEngine User Guide (https://github.com/ExpressionEngine/ExpressionEngine-User-Guide)
8+
9+
@link https://expressionengine.com/
10+
@copyright Copyright (c) 2003-2020, Packet Tide, LLC (https://packettide.com)
11+
@license https://expressionengine.com/license Licensed under Apache License, Version 2.0
12+
-->
13+
14+
# Members Fieldtype Extension Hooks
15+
16+
[TOC=3]
17+
18+
### `member_relationships_display_field($entry_id, $field_id, $sql)`
19+
20+
| Parameter | Type | Description |
21+
| ---------- | -------- | ------------------------------------------------------- |
22+
| \$entry_id | `Int` | Entry ID of entry being edited. |
23+
| \$field_id | `Int` | Field ID of field currently being loaded. |
24+
| \$sql | `String` | Compiled SQL about to be run to gather related members. |
25+
| Returns | `Array` | Result Array of query result. |
26+
27+
Allows developers to modify the existing query that retrieves related members for the publish field or to perform their own queries to return related members.
28+
29+
How it's called:
30+
31+
if (ee()->extensions->active_hook('member_relationships_display_field') === TRUE)
32+
{
33+
$related = ee()->extensions->call(
34+
'member_relationships_display_field',
35+
$entry_id,
36+
$this->field_id,
37+
ee()->db->_compile_select()
38+
);
39+
}
40+
else
41+
{
42+
$related = ee()->db->get()->result_array();
43+
}
44+
45+
NOTE: **Note:** To use this hook, you can either add to the existing Active Record call, or call `ee()->db->_reset_select()` to cancel the Active Record call and start your own, or modify the passed compiled SQL.
46+
47+
### `member_relationships_post_save($ships, $entry_id, $field_id)`
48+
49+
| Parameter | Type | Description |
50+
| ---------- | ------- | ---------------------------------------------- |
51+
| \$ships | `Array` | Array of member IDs to be related to the entry. |
52+
| \$entry_id | `Int` | Entry ID of entry being saved. |
53+
| \$field_id | `Int` | Field ID of field currently being saved. |
54+
| Returns | `Array` | Array of relationships. |
55+
56+
Allows developers to modify or add to the relationships array before saving.
57+
58+
How it's called:
59+
60+
$ships = ee()->extensions->call('member_relationships_post_save', $ships, $entry_id, $field_id);

docs/fieldtypes/member.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ Members Fieldtype allows selecting one or multiple members and associating those
1313

1414
[TOC]
1515

16-
Relationships are an extremely powerful tool that allow you to connect Entries in one Channel to those in another one, or even to other entries in the same channel. This ability allows you to store very complex content in your Channel entries.
17-
18-
This fieldtype is currently only limited to Channels.
16+
Members fieldtype is the tool that allow you to connect Members to Channel Entries. This ability allows you to store very complex content in your Channel entries. For example, you could create a Channel called "Articles" and then create a Channel Field called "Authors" that is a Members fieldtype. You could then associate one or more Members with each Article entry. This would allow you to display the author's name, bio, photo, etc. on the Article page.
1917

2018
![members field](_images/field_members.png)
2119

docs/fieldtypes/relationships.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
[TOC]
1313

14-
Relationships are an extremely powerful tool that allow you to connect Entries in one Channel to those in another one, or even to other entries in the same channel. This ability allows you to store very complex content in your Channel entries.
14+
Relationships are an extremely powerful tool that allows you to connect Entries in one Channel to those in another one, or even to other entries in the same channel. This ability allows you to store very complex content in your Channel entries.
1515

1616
This fieldtype is currently only limited to Channels.
1717

docs/toc_sections/_advanced_usage_toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@
203203
href: development/extension-hooks/global/pagination.md
204204
- name: Relationships Fieldtype
205205
href: development/extension-hooks/global/relationships.md
206+
- name: Members Fieldtype
207+
href: development/extension-hooks/global/member-ft.md
206208
- name: Session Library
207209
href: development/extension-hooks/global/session.md
208210
- name: Template Library

0 commit comments

Comments
 (0)