src/Charcoal/Admin/ServiceProvider/AdminServiceProvider.php
protected function registerMetadataExtensions(Container $container)
    {
        if (!isset($container['metadata/config'])) {
            /**
             * @return MetadataConfig
             */
            $container['metadata/config'] = function () {
                return new MetadataConfig();
            };
        }

        /**
         * Alters the application's metadata configset.
         *
         * This extension will duplicate each previously defined
         * metadata include path to introduce an "admin" subdirectory
         * which adds support for Admin-only metadata settings.
         *
         * For example, if a developer defines the following paths:
         *
         * ```json
         * "paths": [
         *     "my-app/metadata/",
         *     "vendor/locomotivemtl/charcoal-cms/metadata/"
         * ]
         * ```
         *
         * The Admin's service provider will duplicate like so:
         *
         * ```json
         * "paths": [
         *     "my-app/metadata/admin/",
         *     "my-app/metadata/",
         *     "vendor/locomotivemtl/charcoal-cms/metadata/admin/"
         *     "vendor/locomotivemtl/charcoal-cms/metadata/"
         * ]
         * ```
         *
         * Any data included from the "admin" subdirectory will override
         * any "base" data that's been imported.
         *
         * @param  MetadataConfig $metaConfig The metadata configset.
         * @param  Container      $container  The Pimple DI container.
         * @return MetadataConfig
         */
        $container->extend('metadata/config', function (MetadataConfig $metaConfig, Container $container) {
            $adminConfig = $container['admin/config'];
            $adminDir    = '/'.trim($adminConfig['base_path'], '/');

            $metaPaths   = $metaConfig->paths();
            $parsedPaths = [];
            foreach ($metaPaths as $basePath) {
                $adminPath = rtrim($basePath, '/').$adminDir;

                array_push($parsedPaths, $adminPath, $basePath);
            }

            $metaConfig->setPaths($parsedPaths);

            return $metaConfig;
        });
    }
protected function registerMetadataExtensions(Container $container)
    {
        if (!isset($container['metadata/config'])) {
            /**
             * @return MetadataConfig
             */
            $container['metadata/config'] = function () {
                return new MetadataConfig();
            };
        }

        /**
         * Alters the application's metadata configset.
         *
         * This extension will duplicate each previously defined
         * metadata include path to introduce an "admin" subdirectory
         * which adds support for Admin-only metadata settings.
         *
         * For example, if a developer defines the following paths:
         *
         * ```json
         * "paths": [
         *     "my-app/metadata/",
         *     "vendor/locomotivemtl/charcoal-cms/metadata/"
         * ]
         * ```
         *
         * The Admin's service provider will duplicate like so:
         *
         * ```json
         * "paths": [
         *     "my-app/metadata/admin/",
         *     "my-app/metadata/",
         *     "vendor/locomotivemtl/charcoal-cms/metadata/admin/"
         *     "vendor/locomotivemtl/charcoal-cms/metadata/"
         * ]
         * ```
         *
         * Any data included from the "admin" subdirectory will override
         * any "base" data that's been imported.
         *
         * @param  MetadataConfig $metaConfig The metadata configset.
         * @param  Container      $container  The Pimple DI container.
         * @return MetadataConfig
         */
        $container->extend('metadata/config', function (MetadataConfig $metaConfig, Container $container) {
            $adminConfig = $container['admin/config'];
            $adminDir    = '/'.trim($adminConfig['base_path'], '/');

            $metaPaths   = $metaConfig->paths();
            $parsedPaths = [];
            foreach ($metaPaths as $basePath) {
                $adminPath = rtrim($basePath, '/').$adminDir;

                array_push($parsedPaths, $adminPath, $basePath);
            }

            $metaConfig->setPaths($parsedPaths);

            return $metaConfig;
        });
    }
protected function registerMetadataExtensions ( Container $ container ) { if ( ! isset ( $ container [ 'metadata/config' ] ) ) { /**
             * @return MetadataConfig
             */ $ container [ 'metadata/config' ] = function ( ) { return new MetadataConfig ( ) ; } ; } /**
         * Alters the application's metadata configset.
         *
         * This extension will duplicate each previously defined
         * metadata include path to introduce an "admin" subdirectory
         * which adds support for Admin-only metadata settings.
         *
         * For example, if a developer defines the following paths:
         *
         * ```json
         * "paths": [
         *     "my-app/metadata/",
         *     "vendor/locomotivemtl/charcoal-cms/metadata/"
         * ]
         * ```
         *
         * The Admin's service provider will duplicate like so:
         *
         * ```json
         * "paths": [
         *     "my-app/metadata/admin/",
         *     "my-app/metadata/",
         *     "vendor/locomotivemtl/charcoal-cms/metadata/admin/"
         *     "vendor/locomotivemtl/charcoal-cms/metadata/"
         * ]
         * ```
         *
         * Any data included from the "admin" subdirectory will override
         * any "base" data that's been imported.
         *
         * @param  MetadataConfig $metaConfig The metadata configset.
         * @param  Container      $container  The Pimple DI container.
         * @return MetadataConfig
         */ $ container -> extend ( 'metadata/config' , function ( MetadataConfig $ metaConfig , Container $ container ) { $ adminConfig = $ container [ 'admin/config' ] ; $ adminDir = '/' . trim ( $ adminConfig [ 'base_path' ] , '/' ) ; $ metaPaths = $ metaConfig -> paths ( ) ; $ parsedPaths = [ ] ; foreach ( $ metaPaths as $ basePath ) { $ adminPath = rtrim ( $ basePath , '/' ) . $ adminDir ; array_push ( $ parsedPaths , $ adminPath , $ basePath ) ; } $ metaConfig -> setPaths ( $ parsedPaths ) ; return $ metaConfig ; } ) ; }
Registers metadata extensions.

@see    \Charcoal\Model\ServiceProvider\ModelServiceProvider
@param  Container $container The Pimple DI container.
@return void
Registers metadata extensions .