Skip to content

Commit b2a3030

Browse files
authored
Merge pull request #582 from ExpressionEngine/7.dev
Updating docs for 7.x release.
2 parents 72003b5 + a540631 commit b2a3030

File tree

9 files changed

+246
-44
lines changed

9 files changed

+246
-44
lines changed

docs/development/addon-setup-php-file.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,5 +236,14 @@ It is also possible to set up class aliases to an arbitrary FQCN. The example be
236236
'MyVendor\Services\ClassName' => 'AnotherVendor\Services\ClassName',
237237
],
238238

239+
### `requires`
240+
241+
'requires' => [
242+
'php' => '8.0',
243+
'ee' => '7.2.0'
244+
],
245+
246+
If your add-on requires a particular version of ExpressionEngine, or a minimum version of PHP, adding `requires` to your addon.setup.php will check for minimum versions of the specified framework, and will stop installation if the minimum requirement is not meant.
247+
239248
## Accessing Add-On Information From Another Add-on
240249
See the [Addon Service](development/services/addon.md) for API access.

docs/development/models/channel-field.md

Lines changed: 158 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,85 @@ lang: php
2020
## Properties
2121

2222
### Required
23-
24-
- `site_id`
25-
- `field_name`
26-
- `field_label`
27-
- `field_type`
28-
- `field_list_items` (can be empty)
29-
- `field_order`
23+
| Name | Validation | Type | Description |
24+
| ----------------------- |------------ | ---------- | ----------- |
25+
| `site_id` | required | integer | |
26+
| `field_name` | required, alphaDash, unique(installation wide), validateNameIsNotReserved, maxLength[32]| | |
27+
| `field_label` | required, maxLength[50] | | |
28+
| `field_type` | required, validateIsCompatibleWithPreviousValue, enum[checkboxes, colorpicker, date, duration, email_address , file, file_grid, fluid_field, grid, multi_select, notes, radio, range_slider, relationship, rte, select, selectable_buttons, slider, text, textarea, toggle, url] (or the name of a custom field type)| |validateIsCompatibleWithPreviousValue is used when modifying the field_type of an existing field. Please see [Fieldtype Compatibility Options](development//addon-setup-php-file.md#fieldtypes) for more details. |
29+
| `field_order` | | integer | |
30+
| `field_list_items` | required (can be an empty string) | | The simplest of three mutual exclusive ways to populate a list of items is using a string with items separated by line breaks \n. Used with listing field types (Checkboxes, Multi Select, Radio Buttons, Select Dropdown and Selectable Buttons) when field_settings['value_label_pairs'] is not set and 'field_pre_populate' == 'n' (do not populate from channel entries)|
3031

3132
### Optional
33+
| Name | Validation | Type | Description |
34+
| ----------------------- |------------ | ---------- | ----------- |
35+
| `field_id` | | integer | |
36+
| `field_instructions` | | | |
37+
| `field_pre_populate` | enum[y,n,v] | boolString | if 'y' populate a list of items from channel entries. Used in conjunction with the two properties `field_pre_channel_id` and `field_pre_field_id` |
38+
| `field_pre_channel_id` | | integer | |
39+
| `field_pre_field_id` | | integer | |
40+
| `field_ta_rows` | | integer | height of a textarea field in rows |
41+
| `field_maxl` | | integer | max length of a text input field |
42+
| `field_required` | enum[y,n] | boolString | |
43+
| `field_text_direction` | enum[ltr,rtl] | | |
44+
| `field_search` | enum[y,n] | boolString | |
45+
| `field_is_hidden` | enum[y,n] | boolString | |
46+
| `field_fmt` | | enum[br,xhtml,none] | used only by some field types, 'br' stands for auto line break |
47+
| `field_show_fmt` | enum[y,n] | boolString | |
48+
| `field_content_type` | enum[all,any,image,integer,text] | | |
49+
| `field_settings` | | base64Serialized | Specific settings depending on the field type. See the following table. |
50+
| `legacy_field_data` | | boolString | |
51+
52+
## Field settings
53+
54+
The property `field_settings` consists in an array of settings that depend on the field type. Here are the most common settings for the standard field types. field settings are stored in the database column 'field_settings' as a base64 encoded string of the serialized array.
55+
56+
| Field types | Setting name | Values | Description |
57+
| ------------------- |------------ | ---------- | ----------- |
58+
| Checkboxes, Multi Select, Radio Buttons, Select Dropdown, Selectable Buttons | `value_label_pairs` | associative array | |
59+
| Color Picker | `allowed_colors` | enum[any,swatches] | |
60+
| Color Picker | `colorpicker_default_color` | | hex color code, or null |
61+
| Color Picker | `value_swatches` | array | array of hex color codes, used when `populate_swatches` is set to 'v' (value) |
62+
| Color Picker | `manual_swatches` | | hex color codes separated by line breaks, or null, used when `populate_swatches` is set to 'm' (manual) |
63+
| Color Picker | `populate_swatches` | enum[m,v] | 'm' manual or 'v' value |
64+
| Duration | `units` | enum[seconds,minutes,hours] | |
65+
| File, file_grid | `field_content_type` | enum[image,all] | |
66+
| File, file_grid | `allowed_directories` | 'all' (or integer for upload directory id) | required |
67+
| File | `show_existing` | enum[y,n] | When enabled, a drop down with existing files will be shown to authors. |
68+
| File | `num_existing` | integer | Maximum number of files to show in the drop down. |
69+
| File, Rich text editor | `field_fmt` | 'none' | |
70+
| file_grid, grid | `grid_min_rows` | integer | default 0 |
71+
| file_grid, grid | `grid_max_rows` | integer | |
72+
| file_grid, grid | `allow_reorder` | enum[y,n] | |
73+
| fluid_field | `field_channel_fields` | array | channel IDs used in the fluid field |
74+
| Notes | `note_content` | text | default is ''|
75+
| Notes | `field_hide_title` | bool | default is true |
76+
| Notes | `field_hide_publish_layout_collapse`| bool | default is true |
77+
| Range slider, value slider | `field_min_value` | integer | default to 0 |
78+
| Range slider, value slider | `field_max_value` | integer | default to 100|
79+
| Range slider, value slider | `field_step` | integer | default to 1 |
80+
| Range slider, value slider | `field_prefix`,`field_suffix` | | |
81+
| Range slider, value slider, Text input | `field_content_type` | enum[all,number,integer,decimal] | |
82+
| relationship | `channels` | array | channel IDs |
83+
| relationship | `expired`, `future` | | Allow expired or future entries in this relationships field |
84+
| relationship | `categories`, `authors`, `statuses`| array | limit the entries by categories, authors or statuses IDs |
85+
| relationship | `limit` | integer | Sets the number of entries displayed in the field's dropdown |
86+
| relationship | `order_field`, `order_dir` | enum[title,entry_date] , enum[asc,desc] | Default ordering of entries |
87+
| relationship | `display_entry_id` | enum[y,n] | |
88+
| relationship | `allow_multiple` | enum[y,n] | |
89+
| Rich text editor | `toolset_id` | integer | see Rich Text Editor addon for details, for a standard installation: 1 CKEditor Basic, 2 CKEditor Full, 3 Redactor Basic, 4 Redactor Full |
90+
| Rich text editor | `defer` | enum[y,n] | Defer Editor initialization |
91+
| Rich text editor, Textarea | `db_column_type` | enum[text,mediumtext]| Column type in database: TEXT(64Kb) MEDIUMTEXT(16Mb) |
92+
| Rich text editor | `field_wide` | bool | default true, full width |
93+
| Rich text editor | `field_show_fmt` | enum[y,n] | default 'n' |
94+
| Text input | `field_maxl` | integer | Maximum characters |
95+
| Text input, Textarea | `field_show_smileys` | enum[y,n] | |
96+
| Text input, Textarea | `field_show_file_selector` | enum[y,n] | |
97+
| Textarea | `field_show_formatting_btns` | enum[y,n] | |
98+
| Toggle | `field_default_value` | enum[0,1] | |
99+
| URL | `allowed_url_schemes` | array | example ['http://','https://'] |
100+
| URL | `url_scheme_placeholder` | | example 'http://' |
32101

33-
- `field_id` Key
34-
- `field_instructions`
35-
- `field_pre_populate`
36-
- `field_pre_channel_id`
37-
- `field_pre_field_id`
38-
- `field_ta_rows`
39-
- `field_maxl`
40-
- `field_required`
41-
- `field_text_direction`
42-
- `field_search`
43-
- `field_is_hidden`
44-
- `field_fmt`
45-
- `field_show_fmt`
46-
- `field_content_type`
47-
- `field_settings`
48-
- `legacy_field_data`
49102

50103
## Relationships
51104

@@ -60,7 +113,7 @@ lang: php
60113
- `getContentType`
61114
- `getSettingsValues`
62115
- `getAllChannels`
63-
- `validateNameIsNotReserved`
116+
- `validateNameIsNotReserved` the list of reserved words is in /ee/legacy/libraries/Cp.php: invalid_custom_field_names()
64117
- `validateIsCompatibleWithPreviousValue`
65118

66119
## Events
@@ -164,3 +217,84 @@ if ($result->isValid())
164217
$field->save();
165218
}
166219
```
220+
221+
### Populate a field compatible with list field types
222+
223+
For fields like Checkboxes, Multi Select, Radio Buttons, Select Dropdown and Selectable Buttons there are three ways to populate their options: value-labels pairs, manually or from other channel.
224+
225+
```php
226+
// populate manually
227+
$field->setProperty('field_list_items', "first\nsecond\nthird");
228+
// Validate and Save.
229+
```
230+
```php
231+
// populate with value-labels pairs
232+
$checkboxes_settings = array(
233+
'value_label_pairs' => array('winner' => 'first', 'player' => 'second', 'loser' => 'third')
234+
);
235+
// change field settings
236+
$changing_settings = $field->getSettingsValues()['field_settings'];
237+
foreach ($checkboxes_settings as $s => $s_value) {
238+
$changing_settings[$s] = $s_value;
239+
}
240+
$field->setProperty('field_settings', $changing_settings);
241+
// Validate and Save.
242+
```
243+
```php
244+
// or populate from other channel field
245+
$field->setProperty('field_pre_populate','y'); // default is 'n'
246+
$field->setProperty('field_pre_channel_id',4); //channel id
247+
$field->setProperty('field_pre_field_id',80); // field id
248+
// Validate and Save.
249+
```
250+
251+
### Create a relationship field
252+
253+
```php
254+
//Relationships with channel #4
255+
256+
//all properties are required
257+
$relata_properties = array(
258+
'field_label' => 'relata',
259+
'field_name' => 'relata',
260+
'field_type' => 'relationship',
261+
'field_list_items' => ''
262+
);
263+
264+
//all settings are optional
265+
$relata_settings = array(
266+
'channels' => array(4), // if missing relates to all channels
267+
'expired' => true, // if missing defaults to false
268+
'future' => true, // if missing defaults to false
269+
'categories' => array(), // if missing or empty allows relationships with all categories
270+
'authors' => array(), // if missing or empty allows relationships with all authors
271+
'statuses' => array('open'), // if missing or empty allows relationships with all statuses
272+
'order_field' => 'entry_date', // default is by title
273+
'order_dir' => 'desc', // default is ascending
274+
'display_entry_id' => null, //default is false
275+
'allow_multiple' => true, // default is true
276+
'rel_min' => 0, //Minimum number of related entries
277+
'rel_max' => null // Maximum number of related entries
278+
);
279+
280+
$field = ee('Model')->make('ChannelField');
281+
282+
$site_id = ee()->config->item('site_id');
283+
$field->site_id = $site_id;
284+
// field_order: increment the last field order number of fields belonging to this site
285+
$ordernumber = 1 + ee('Model')->get('ChannelField')->filter('site_id',$site_id)->order('field_order', 'DESC')->first()->field_order;
286+
$field->field_order = $ordernumber;
287+
288+
// field settings
289+
$changing_settings = $field->getSettingsValues()['field_settings'];
290+
foreach ($relata_settings as $s => $s_value) {
291+
$changing_settings[$s] = $s_value;
292+
}
293+
$field->setProperty('field_settings', $changing_settings);
294+
295+
// field properties
296+
foreach ($relata_properties as $p => $p_val) {
297+
$field->setProperty($p, $p_val);
298+
}
299+
// Validate and Save.
300+
```

docs/development/services/model/building-your-own.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ NOTE: **Note:** Event names typically start with a lowercase letter, but the met
126126

127127
## Relationships
128128

129-
_In-Depth Documentation:_ [Relating Models](development/services/model/relating-models.md))
129+
_In-Depth Documentation:_ [Relating Models](development/services/model/relating-models.md)
130130

131131
Models can be related to other models using just a little bit of metadata. They are defined on a `$_relationships` metadata array. The array keys should be the relationship names, and their values will be a description of the relationship:
132132

@@ -195,7 +195,7 @@ Validation rules are added using the same format as the [Validation Service](dev
195195
You can also create your own local validation rules. These one-off rules can be added directly to the model class by creating a public method whose name starts with `validate`. The method will be treated as a [custom validation rule](development/services/validation.md#custom-rules). On validation it will receive the property name, current value, rule parameters, and the rule object. The method should return `TRUE` on success, and an error string or language key on failure:
196196

197197
protected static $_validation_rules = array(
198-
'even_number' => 'validateMultipleOf[2]'
198+
'even_number' => 'validateMultipleOf[2]',
199199
'decade' => 'validateMultipleOf[10]'
200200
);
201201

docs/general/system-configuration-overrides.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Example Usage:
153153

154154
### `allow_signatures`
155155

156-
Set whether member signatures are enabled.
156+
Set whether member signatures are enabled when using Discussion Forum.
157157

158158
| Value | Behavior |
159159
| ----- | ------------------------- |
@@ -2711,7 +2711,7 @@ Example Usage:
27112711

27122712
### `sig_allow_img_hotlink`
27132713

2714-
Specify whether members can link to images hosted on other websites as their signature image.
2714+
Specify whether members can link to images hosted on other websites as their signature image for Discussion Forum.
27152715

27162716
| Value | Behavior |
27172717
| ----- | -------------------------------------------------------- |
@@ -2724,7 +2724,7 @@ Example Usage:
27242724

27252725
### `sig_allow_img_upload`
27262726

2727-
Set whether members can upload their own signature image.
2727+
Set whether members can upload their own signature image for Discussion Forum.
27282728

27292729
| Value | Behavior |
27302730
| ----- | ------------------------------------------------------------------ |
@@ -2737,7 +2737,7 @@ Example Usage:
27372737

27382738
### `sig_img_max_height`
27392739

2740-
Set the maximum height (in pixels) allowed for user-uploaded signature images.
2740+
Set the maximum height (in pixels) allowed for user-uploaded signature images in Discussion Forum.
27412741

27422742
| Value | Description |
27432743
| ------- | ---------------------- |
@@ -2749,7 +2749,7 @@ Example Usage:
27492749

27502750
### `sig_img_max_kb`
27512751

2752-
Set the maximum file size (in kilobytes) allowed for user-uploaded signature images.
2752+
Set the maximum file size (in kilobytes) allowed for user-uploaded signature images in Discussion Forum.
27532753

27542754
| Value | Description |
27552755
| ------- | ---------------------------- |
@@ -2761,7 +2761,7 @@ Example Usage:
27612761

27622762
### `sig_img_max_width`
27632763

2764-
Set the maximum width (in pixels) allowed for user-uploaded signature images.
2764+
Set the maximum width (in pixels) allowed for user-uploaded signature images in Discussion Forum.
27652765

27662766
| Value | Description |
27672767
| ------- | --------------------- |
@@ -2797,7 +2797,7 @@ Example Usage:
27972797

27982798
### `sig_maxlength`
27992799

2800-
Set the maximum number of characters allowed in a member's signature.
2800+
Set the maximum number of characters allowed in a member's signature for Discussion Forum.
28012801

28022802
| Value | Description |
28032803
| ------- | ----------------------------------------------- |

docs/installation/best-practices.md

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

1616
ExpressionEngine's system files and directories are typically safe from direct HTTP access on a properly configured server.
1717

18-
However, for increased security we recommend that the `system` folder either be renamed or moved entirely above the public web root folder (commonly named public_html or referred to as simply "webroot") and that admin.php be renamed as well. This document describes the renaming process.
18+
However, for increased security, we recommend that the `system` folder either be renamed or moved entirely above the public web root folder (commonly named `public_html` or referred to as simply "webroot") and that `admin.php` be renamed as well. This document describes the renaming process.
1919

2020
## Renaming the System Directory
2121

0 commit comments

Comments
 (0)