Mustafa-Online

How To Remove Breadcrumbs & modify Headline ?

Recommended Posts

To remove the breadcrumbs, and change headline and browser title:

$this->addHookBefore('Process::execute', function (HookEvent $e) {
    /** @var Process $process */
    $process = $e-object;
    if ($process != "ProcessModule") return;
    $e->wire('breadcrumbs')->removeAll();
    $e->wire('processHeadline', 'asd');
    $e->wire('processBrowserTitle', 'asd');
});

You can't really remove headline and browser title, because admin theme defaults to page name if it doesn't exist.

// AdminThemeDefaultHelpers.php

/**
 * Get the headline for the current admin page
 *
 * @return string
 *
 */
public function getHeadline() {
    $headline = $this->wire('processHeadline'); 
    if(!$headline) $headline = $this->wire('page')->get('title|name'); 
    // ...
}


/**
 * Render the browser <title>
 *
 * @return string
 *
 */
public function renderBrowserTitle() {
    $browserTitle = $this->wire('processBrowserTitle'); 
    if(!$browserTitle) $browserTitle = $this->_(strip_tags($this->wire('page')->get('title|name'))) . ' • ProcessWire';
    // ...
}

But you can set it to a unicode space character, like &nbsp; which works well enough.

$e->wire('processHeadline', "&nbsp;");
$e->wire('processBrowserTitle', "&nbsp;");

 

  • Like 4

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By cosmicsafari
      Hi all,
      I am using the formSubmitSuccess form builder hook to send a copy of the form submission to a third party.
      However I couldn't figure out how to get the submissions form type at this point, the reason being is that I only want to send the data onto the third party for certain form types.
      I don't have the submission details being passed into the hook, wasn't sure how to achieve this so at the moment I have it doing a DB query to pull the latest submission details for that form type so I'm rather stumped about how I can go about achieving this.
      Hope thats makes sense.
    • By joe_g
      Hi there,
      I'm trying to limit a specific user can only add pages as a child (under) a page created by themselves.  
      The discussion in this thread gets close, it's a working solution on how to only allow editing on pages you created yourself. I'm using this and it works well. But I'm not sure how to modify this for my purposes. 
       
      I'm suspecting I need to do to something like
      $this->addHookBefore("Page::added", $this, 'added');
      then in "added" check if parent is created by the current user. But I'm a bit lost on how exactly to do this.
      thank you! /J
       
    • By suntrop
      Sometimes I need pages in the site tree that are basically just a reference to another page – to redirect to the original page or display the same content under the new page url.
      I was surprised I couldn't find anything like that in the forum or as a module already. However, there is a new module by @Robin S but not exactly what I need.
      Example
      Home News Press Newsroom Media Services About Newsroom (virtual page for /news/newsroom/) Contact Example I: The page /about/newsroom/ should act as /news/newsroom/ – so, wehen I loop all pages for a sitemap both pages should have the URL /news/newsroom/.
      Example II: Another example (not often used) would be tu display the exact same content on /about/newsroom/ – although the page itself has no content on its own.
      Those examples don't have much in common, but they are just virtual or fake pages in the site tree.
      While the second one should be an easy task with wireRenderFile(), the first example isn't quite obvious to me. I think I have to use hooks and I have no idea where to start. I really appreciate you guys come up with a solution for everything, but I need to learn this myself  So just some hints to start would be great!
      Do I put the code into a module or some of the _init.php, ready.php etc. files? Or do I have to use a template file (e.g. virtual-page.php)? When I look into Captain Hook  – how do I find the appropriate point to hook into? (/wire/core/ Page.php and loaded()?) Do I need to create/manipulate each field separately (path, title, summary)? Sorry for the long read
       
    • By Pixrael
      Hi guys!
      What do you think about something like this? Because I use this option regularly in the Windows File Explorer breadcrumb and it's very useful. The drop-down menu can display only published/visible child pages. I've tried to find how to do it as a module, but I'm not a coder with enough skills for that ... or I don't know if I can use hooks to do that ...

    • By maxf5
      Hey guys,
      i have some sort of events/campaigns which have a lifespan. To deactivate them i made a checkbox-field called closed and i have to deactivate them manually.
      I would like to put two fields in the template, startdate and enddate, which activate/deactivate that checkbox field automatically.
      Dou you have any idea how to bring that on the run?