-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #273 from alleyinteractive/hook-attributes
Allow attributes to register hooks
- Loading branch information
Showing
4 changed files
with
83 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ jobs: | |
strategy: | ||
fail-fast: true | ||
matrix: | ||
php: [7.4] | ||
php: [8.0] | ||
|
||
name: Coding Standards | ||
|
||
|
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,26 @@ | ||
<?php | ||
/** | ||
* Action class file | ||
* | ||
* @package Mantle | ||
*/ | ||
|
||
namespace Mantle\Support\Attributes; | ||
|
||
use Attribute; | ||
|
||
/** | ||
* Hook Action Attribute | ||
* | ||
* Used to hook a method to an WordPress action at a specific priority. | ||
*/ | ||
#[Attribute] | ||
class Action { | ||
/** | ||
* Constructor. | ||
* | ||
* @param string $action Action name. | ||
* @param int $priority Priority, defaults to 10. | ||
*/ | ||
public function __construct( public string $action, public int $priority = 10 ) {} | ||
} |
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