-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev/core#5654 add support for tagging Afforms using Tag entity #31890
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3acc57a
Afform Tags - add serialized field to Afform entity
ufundo 3f3eac9
Afform Tags - add to FormBuilder individual form edit screen
ufundo 6b3561a
Afform Tags - add to FormBuilder afform listing
ufundo 7df9a4c
Afform Tags - add to search kit reports listing
ufundo c86b0ed
Afform Tags - use Tag entity rather than option group
ufundo ae78210
Afform Tags - include link to Manage Tags from Form tag edit
ufundo 1593b86
FormBuilder UI - add . to help message for consistency
ufundo 5391e4d
AfformTags - Filter out afform tags from being used for sql
colemanw d90fc2b
Test fix - limit taggable entities to those supported by the entityTa…
colemanw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
namespace Civi\Api4\Utils; | ||
|
||
/** | ||
* Class AfformTags | ||
* @package Civi\Api4\Utils | ||
* | ||
* Utils for managing the tags field on Afforms | ||
* | ||
*/ | ||
class AfformTags { | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public static function getTagOptions(): array { | ||
$tagRecords = (array) \Civi\Api4\Tag::get(FALSE) | ||
->addSelect('name', 'label', 'description', 'color') | ||
->addWhere('used_for', 'CONTAINS', 'Afform') | ||
->addWhere('is_selectable', '=', TRUE) | ||
->execute(); | ||
|
||
$tagOptions = []; | ||
|
||
// prefer tag names to keys for portability | ||
foreach ($tagRecords as $record) { | ||
$record['id'] = $record['name']; | ||
$tagOptions[] = $record; | ||
} | ||
|
||
return $tagOptions; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
use CRM_Afform_ExtensionUtil as E; | ||
|
||
// This file: | ||
// - adds option value to `tag_used_for`, allowing Afforms to be tagged | ||
// NOTE: this is unusual in that afform is not a db entity | ||
// (normally the value normally corresponds to a physical table name in the | ||
// database - here it is just the entity name) | ||
return [ | ||
[ | ||
'name' => 'AfformTags:tag_used_for', | ||
'entity' => 'OptionValue', | ||
'cleanup' => 'always', | ||
'update' => 'always', | ||
'params' => [ | ||
'version' => 4, | ||
'values' => [ | ||
'option_group_id.name' => 'tag_used_for', | ||
'value' => 'Afform', | ||
'name' => 'Afform', | ||
'label' => E::ts('Afforms'), | ||
'is_reserved' => TRUE, | ||
'is_active' => TRUE, | ||
// this excludes it from being selected in EntityTag entity_table | ||
'filter' => 1, | ||
], | ||
'match' => ['option_group_id', 'name'], | ||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is filter normally used for ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not much of anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it have a more semantic value? Like filter = 'tableless' and then the condition != tableless?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh the table column is an
int
.. so noThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a comment for the significance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And removed the example tag