Search the blog

Use the following code sample to add custom tabs in the admin with ProcessWire.

\ProcessWire\wire()->addHookAfter('ProcessPageEdit::buildForm', function(\ProcessWire\HookEvent $event) {

    $page = $event->object->getPage();

    if ($page->template == 'my-template') { // Add to specific templates

        $form          = $event->return;
        $inputfields   = new \ProcessWire\InputfieldWrapper();

        $tab           = new \ProcessWire\InputfieldWrapper();

        $tab->attr('title', 'Title of your tab goes here'); // What appears on the tab
        $tab->attr('class', 'WireTab'); // Make it look like a tab

        $markup        = $this->modules->get('InputfieldMarkup');
        $markup->label = 'Clone'; // What appears as the heading once the tab is active

        $markup->value = '<p>Your HTML goes here.</p>';

        $tab->add($markup);

        $inputfields->add($tab);

        $form->prepend($tab);
    }

});
Tim Bennett is a Leeds-based web designer from Yorkshire. He has a First Class Honours degree in Computing from Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.