Use plugin version as asset version

This commit is contained in:
Alex P 2022-02-17 18:51:24 +02:00
parent 651099705a
commit 0c07ebd629
11 changed files with 72 additions and 24 deletions

View file

@ -14,8 +14,14 @@ use Psr\Container\ContainerInterface;
use WpOop\WordPress\Plugin\PluginInterface;
return array(
'ppcp.plugin' => function( ContainerInterface $container ) : PluginInterface {
'ppcp.plugin' => function( ContainerInterface $container ) : PluginInterface {
$factory = new FilePathPluginFactory( new StringVersionFactory() );
return $factory->createPluginFromFilePath( dirname( realpath( __FILE__ ), 2 ) . '/woocommerce-paypal-payments.php' );
},
'ppcp.asset-version' => function( ContainerInterface $container ) : string {
$plugin = $container->get( 'ppcp.plugin' );
assert( $plugin instanceof PluginInterface );
return (string) $plugin->getVersion();
},
);