الإعدادات
انشر ملف الإعدادات لتغيير القيم الافتراضية لكل الـ resources:
bash
php artisan vendor:publish --tag=filament-relation-navigator-configيستمر ملف الإعدادات المنشور في العمل عبر الإصدارات الثانوية (minor): لكل مفتاح قيمة افتراضية في الشيفرة، لذا لا تحتاج إلى إضافة المفاتيح الجديدة إلا عندما تريد تغييرها.
الخيارات
يمكن ضبط معظم الخيارات أيضًا لكل resource (دالة static على الـ resource) أو لكل صفحة أو relation manager:
- خيارات القائمة (
menu.*التي لها دالة، والتنقل بين السجلات، وإعادة توجيه التبويبات): تفوز الصفحة، ثم الـ resource، ثم الإعدادات. - «فتح كصفحة» وشارة الـ relation manager في القائمة: لا تظهر إلا عندما تسمح بها كل المستويات؛ ويمكن لأي مستوى تعطيلها.
- روابط البحث العام: دالة الـ resource تحل محل الإعدادات لذلك الـ resource؛ ولا يستطيع الـ relation manager إلا استبعاد نفسه.
- قائمة السجلات المحفوظة لزري السابق والتالي: يقررها الـ resource أو الإعدادات فقط، لأن صفحة القائمة لا يمكنها سؤال صفحة السجل.
menu.presetsوmenu.search_fromوmenu.max_heightوmenu.separatorموجودة في الإعدادات فقط.
| المفتاح | الافتراضي | ماذا يفعل | المستويات الأخرى |
|---|---|---|---|
menu.preset | 'github' | شكل القائمة: github أو simple أو نمط من عندك أو اسم قالب | getRelationNavigatorPreset() |
menu.presets | simple، github | أسماء الأنماط وقوالبها | |
menu.searchable | true | حقل بحث أعلى القائمة | isRelationNavigatorSearchable() |
menu.search_from | 0 | عرض حقل البحث ابتداء من هذا العدد من العناصر | |
menu.badges | 'lazy' | 'lazy': تُحمَّل الشارات عند فتح القائمة؛ true: مع الصفحة؛ false: بلا شارات | hasRelationNavigatorBadges()، hasDeferredRelationNavigatorBadges()؛ relation manager: hasRelationNavigatorBadge() |
menu.max_height | '24rem' | ارتفاع القائمة قبل أن يظهر التمرير (طول CSS) | |
menu.separator | true | صفحات السجل وصفحات العلاقات في كتلتين | |
menu.mobile | true | القائمة فوق عنوان الصفحة في الشاشات الصغيرة | hasRelationNavigatorMobileMenu() |
menu.shortcut | 'alt+shift+r' | اختصار لوحة المفاتيح الذي يفتح القائمة؛ null: بلا اختصار | getRelationNavigatorShortcut() |
relation_manager_link | true | إجراء «فتح كصفحة» على جداول الـ relation managers | الـ resource: hasRelationPageLinks()، الـ relation manager: hasRelationPageLink() |
relation_manager_action | رابط مع سهم | شكل ذلك الإجراء: style، label، icon، icon_position، color، size، new_tab | configureRelationPageActionUsing()، configureRelationPageAction() |
global_search_actions | false | روابط إلى صفحات العلاقات تحت نتائج البحث العام: true أو الحد الأقصى لكل نتيجة | الـ resource: hasRelationPageGlobalSearchActions()، الـ relation manager: hasRelationPageGlobalSearchAction() |
record_navigation | false | زرا السجل السابق والتالي | hasRelationNavigatorRecordNavigation() |
record_navigation_follows_list | true | يتبع زرا السابق والتالي قائمة السجلات التي جاء منها المستخدم | shouldRelationNavigatorRecordNavigationFollowList() |
redirect_relation_tabs | false | ?relation=x في صفحة العرض يفتح صفحة العلاقة | shouldRedirectRelationNavigatorTabs() |
دوال الصفحة دوال نسخة (instance) على صفحة سجل تستخدم HasRelationNavigator؛ وعلى الـ resource تكون الدالة نفسها static وتنطبق على كل صفحاته. انظر الصفحة ثم resource ثم config.
الملف كاملًا
كما يأتي مع الإصدار الحالي (التعليقات بالإنجليزية):
php
<?php
return [
/*
|--------------------------------------------------------------------------
| Breadcrumb menu
|--------------------------------------------------------------------------
|
| `preset` picks one of `presets`:
|
| - github (default): the last breadcrumb stays text, a caret next to it
| opens a panel with a heading and a check on the current page
| (like GitHub's "Switch repository").
| - simple: the last breadcrumb itself opens the list.
|
| `searchable` adds a search field on top of the list, whatever the
| preset; Enter opens the first match. For the menu of 1.2 and earlier,
| set `'preset' => 'simple'` and `'searchable' => false`.
|
| Add your own preset by pointing a name to any view, or publish the
| package views and change them:
|
| php artisan vendor:publish --tag=filament-relation-navigator-views
|
| A page can override these with getRelationNavigatorPreset(),
| isRelationNavigatorSearchable() and hasRelationNavigatorBadges().
|
*/
'menu' => [
'preset' => 'github',
'presets' => [
'simple' => 'filament-relation-navigator::menu.simple',
'github' => 'filament-relation-navigator::menu.github',
],
'searchable' => true,
// With `searchable`, the search field appears from this many items.
'search_from' => 0,
// The relation managers' badges, as in their tabs. 'lazy' (default)
// loads them when the menu opens, so the page renders without their
// queries; true renders them with the page; false turns them off. A
// relation manager can leave its badge out: hasRelationNavigatorBadge().
'badges' => 'lazy',
'max_height' => '24rem',
// The record pages and the relation pages in two blocks.
'separator' => true,
// Filament hides the breadcrumbs on small screens: show the menu
// above the page heading there.
'mobile' => true,
// Opens the menu from anywhere on the page, outside text fields:
// modifiers (alt, shift, ctrl, meta, or mod: ⌘ on a Mac, Ctrl
// elsewhere) plus a letter, a digit or / . , ; Null turns it off.
// A shortcut of the panel's global search is ignored, never doubled.
'shortcut' => 'alt+shift+r',
],
/*
|--------------------------------------------------------------------------
| Relation managers on the record pages
|--------------------------------------------------------------------------
|
| An "Open as page" action in the header of the table of every relation
| manager that has its own page, on the view and edit pages. Per resource:
| hasRelationPageLinks(); per relation manager: hasRelationPageLink().
|
*/
'relation_manager_link' => true,
// Its look. `style`: link, button or icon_button (the label becomes a
// tooltip). `label`: text or translation key (null: "Open as page",
// translated). `icon`: any Filament icon, or null for none. For more,
// RelationNavigator::configureRelationPageActionUsing() in a service
// provider, or configureRelationPageAction() on a resource or a relation
// manager.
'relation_manager_action' => [
'style' => 'link',
'label' => null,
'icon' => 'heroicon-m-arrow-up-right',
'icon_position' => 'after',
'color' => 'gray',
'size' => null,
'new_tab' => false,
],
/*
|--------------------------------------------------------------------------
| Global search
|--------------------------------------------------------------------------
|
| Links to the record's relation pages under its global search results:
| false, true, or the most links to show per result. Per resource:
| hasRelationPageGlobalSearchActions(); per relation manager:
| hasRelationPageGlobalSearchAction(). They run the relation managers'
| canViewForRecord() for every result.
|
*/
'global_search_actions' => false,
/*
|--------------------------------------------------------------------------
| Previous and next record
|--------------------------------------------------------------------------
|
| Two buttons before the header actions of the pages with the menu: they
| open the previous or the next record on the same page. Off by
| default: they add a few queries per render. Per page, override
| hasRelationNavigatorRecordNavigation(); to change the records,
| getRelationNavigatorRecordNavigationQuery(). Not for nested resources.
|
*/
'record_navigation' => false,
// Previous and next follow the list the user came from (the list page,
// or the parent's relation manager for a nested resource): its sort,
// filters, search and tab (up to 100 records), instead of the key order.
'record_navigation_follows_list' => true,
/*
|--------------------------------------------------------------------------
| Links to relation manager tabs
|--------------------------------------------------------------------------
|
| A link to a tab of the view or edit page (`/customers/1?relation=bills`)
| opens the relation page instead (`/customers/1/bills`). Handy once the
| relation pages replace the tabs; off by default.
|
*/
'redirect_relation_tabs' => false,
];