Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
noxoua committed Nov 2, 2023
1 parent 0ea3034 commit b9cd028
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
20 changes: 20 additions & 0 deletions docs/006-translated-keys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Translated Keys
nav_order: 8
---

# Translated Keys

The Logger class provides the `attributeMap` property, which allows you to map field keys to make translations user-friendly. This is particularly useful when you want to present field names in a more readable or user-friendly manner.
Here's how you can use the attributeMap property:

```php
public static ?array $attributeMap = [
'name' => 'first_name',
'media' => 'avatar',
];
```

In this example, the `attributeMap` property is defined to map the field keys 'name' to 'first_name' and 'media' to 'avatar'. This mapping allows you to present these fields with more descriptive and user-friendly names in the activity log views or any other related components.

For instance, instead of displaying `name` in the logs, the attribute will be shown as `first_name`, providing a clearer understanding of the logged information. You can configure these mappings based on your application's specific needs, making the logs more accessible and meaningful for users.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Usage with Relations
nav_order: 8
nav_order: 9
---

# Usage with Relations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Complex Field/Relation
nav_order: 9
nav_order: 10
---

# Complex Field/Relation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Link Causer/Subject
nav_order: 10
nav_order: 11
---

# Link Causer/Subject
Expand Down

0 comments on commit b9cd028

Please sign in to comment.