Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions web/wp-content/themes/studiometa/app/Managers/AdminManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/**
* Bootstraps Admin related functions.
*
* @package Studiometa
*/

namespace Studiometa\Managers;

use Studiometa\WPToolkit\Managers\ManagerInterface;

/** Class */
class AdminManager implements ManagerInterface {
// phpcs:ignore Generic.Commenting.DocComment.MissingShort
/**
* @inheritDoc
*/
public function run() {
add_filter( 'login_headerurl', array( $this, 'custom_login_logo_url' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'login_enqueue_scripts', array( $this, 'change_login_logo' ) );
}

/**
* Custom link on login page for the logo
*
* @param String $url URL.
* @return String new url for the logo
*/
public function custom_login_logo_url( $url ) {
return home_url();
}

/**
* Enqueue scripts for the admin
*/
public function enqueue_scripts():void {
wp_enqueue_script( 'linked_content_script', get_template_directory_uri() . '/src/js/admin/index.js', array(), '1', true );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: What is the purpose of this script?

}

/**
* Undocumented function
*
* @return void
*/
public function change_login_logo() {
wp_enqueue_style( 'custom-login', get_stylesheet_directory_uri() . '/dist/css/admin/login-style.css', array(), '1' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Use the AssetsManager like in the TinyMCEManager to get the CSS file path

}
}
2 changes: 2 additions & 0 deletions web/wp-content/themes/studiometa/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Studiometa\Managers\TinyMCEManager;
use Studiometa\Managers\TwigManager;
use Studiometa\Managers\WordPressManager;
use Studiometa\Managers\AdminManager;
use Studiometa\WPToolkit\Managers\AssetsManager;
use Studiometa\WPToolkit\Managers\CleanupManager;
use Studiometa\WPToolkit\Managers\ManagerFactory;
Expand Down Expand Up @@ -65,6 +66,7 @@ function () {
new TaxonomiesManager(),
new TinyMCEManager( $assets_manager ),
new ACFManager(),
new AdminManager(),
);

ManagerFactory::init( $managers );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Update the logo
// #login h1 a {
// }