Skip to content

Commit

Permalink
ability to search for keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Nov 4, 2024
1 parent 464e87e commit a865ea6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions resources/js/components/fields/FieldtypeSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default {
if (!this.fieldtypesLoaded) return [];
let options = this.fieldtypes.map(fieldtype => {
return {text: fieldtype.title, value: fieldtype.handle, categories: fieldtype.categories, icon: fieldtype.icon};
return {text: fieldtype.title, value: fieldtype.handle, categories: fieldtype.categories, keywords: fieldtype.keywords, icon: fieldtype.icon};
});
if (this.allowDate) options.unshift({text: __('Publish Date'), value: 'date', categories: ['system'], isMeta: true, icon: 'date'});
Expand Down Expand Up @@ -133,7 +133,8 @@ export default {
threshold: 0.1,
keys: [
{name: 'text', weight: 1},
{name: 'categories', weight: 0.1}
{name: 'categories', weight: 0.1},
{name: 'keywords', weight: 0.8},
],
});
Expand Down
7 changes: 7 additions & 0 deletions src/Fields/Fieldtype.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ abstract class Fieldtype implements Arrayable
protected $selectableInForms = false;
protected $relationship = false;
protected $categories = [];
protected $keywords = [];
protected $rules = [];
protected $extraRules = [];
protected $defaultValue;
Expand Down Expand Up @@ -113,6 +114,11 @@ public function categories(): array
return $this->categories;
}

public function keywords(): array
{
return $this->keywords;
}

public function filter()
{
return new FieldtypeFilter($this);
Expand Down Expand Up @@ -167,6 +173,7 @@ public function toArray(): array
'validatable' => $this->validatable(),
'defaultable' => $this->defaultable(),
'categories' => $this->categories(),
'keywords' => $this->keywords(),
'icon' => $this->icon(),
'config' => $this->configFields()->toPublishArray(),
];
Expand Down

0 comments on commit a865ea6

Please sign in to comment.