-
-
Notifications
You must be signed in to change notification settings - Fork 836
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.x] Implement Support for Translatable Validation Attribute Errors (#…
…4070) * chore: add validation translations * feat: implement ability to translate validation attributes * chore: change translation key * style: formatting * perf: cache `getAttributeNames` * perf: cache `getAttributeNames` * chore * style: formatting
- Loading branch information
1 parent
79e17b3
commit 397642a
Showing
7 changed files
with
112 additions
and
0 deletions.
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,31 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Flarum. | ||
* | ||
* For detailed copyright and license information, please view the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Flarum\Foundation; | ||
|
||
use Flarum\Extension\Extension; | ||
use Flarum\Extension\ExtensionManager; | ||
|
||
trait ExtensionIdTrait | ||
{ | ||
protected function getClassExtensionId(): ?string | ||
{ | ||
$extensions = resolve(ExtensionManager::class); | ||
|
||
return $extensions->getExtensions() | ||
->mapWithKeys(function (Extension $extension) { | ||
return [$extension->getId() => $extension->getNamespace()]; | ||
}) | ||
->filter(function ($namespace) { | ||
return $namespace && str_starts_with(static::class, $namespace); | ||
}) | ||
->keys() | ||
->first(); | ||
} | ||
} |