Last active
April 14, 2021 20:56
-
-
Save jonschr/7c2eae0708eea6ed01fc0a7e65af459f to your computer and use it in GitHub Desktop.
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 constant should be defined in the main file for the plugin, even if the rest of this code is loaded elsewhere | |
define( 'ELODIN_STAFF_DIR', plugin_dir_path( __FILE__ ) ); | |
use AC\ListScreenRepository\Storage\ListScreenRepositoryFactory; | |
use AC\ListScreenRepository\Rules; | |
use AC\ListScreenRepository\Rule; | |
add_filter( 'acp/storage/repositories', function( array $repositories, ListScreenRepositoryFactory $factory ) { | |
//! Change $writable to true to allow changes to columns for the content types below | |
$writable = false; | |
// Add rules to target individual list tables. | |
// Defaults to Rules::MATCH_ANY added here for clarity, other option is Rules::MATCH_ALL | |
$rules = new Rules( Rules::MATCH_ANY ); | |
$rules->add_rule( new Rule\EqualType( 'staff' ) ); | |
// Register your repository to the stack | |
$repositories['elodin-staff'] = $factory->create( | |
ELODIN_STAFF_DIR . '/acp-settings', | |
$writable, | |
$rules | |
); | |
return $repositories; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment