Jump to content

Add Tab on Admin Edit page with inputfield


Abe Cube
 Share

Recommended Posts

How to add a tab button in edit page(Admin) with some inputfield. These inputfields data then later will be transfered to another database via api. I have searched almost all possibilities but could not find any similar project. I would hightly appreciated any suggestion and code guidance. THANK YOU

Link to comment
Share on other sites

<?php namespace ProcessWire;

class EventClass extends WireData implements Module{

public static function getModuleInfo(){

return array(

'title' => 'Veranschtaltung',
'version' => '01',
'summary' => 'Add inputfield for Events',
'singular' => true,
'autoload' => true,

);

}

public function ready(){

if(wire('page')->process != 'ProcessPageEdit') return;

$this->addHookAfter('ProcessPageEdit::buildForm', $this, 'addTab');
}


public function addTab(HookEvent $event){

$form = $event->return;

// Create Tab
$EventTab = new InputfieldWrapper();
$EventTab = attr('id+name', $this->ClassName() . 'event');
$EventTab = attr('title', $this->_('Veranschtaltung'));


// Add Inputfields (GrundInformation einer Veranstaltung)
$OwnerId = $modules->get('InputfieldInteger');
$OwnerId-> label = 'OwnerId';
$OriginId->attr('Id', 'OwnerId')
$form->append($OwnerId);

$OriginId = $modules->get('InputfieldInteger');
$OriginId-> label = 'OriginId';
$OriginId-> attr('Id', 'OriginId');
$form->append($OriginId);

$OriginLastUpdatedAt = $modules->get('InputfieldDatetime');
$OriginLastUpdatedAt-> label = 'OriginLastUpdatedAt';
$OriginLastUpdatedAt-> attr('Date', 'OriginLastUpdatedAt');
$form->append($OriginLastUpdatedAt);

$Deleted = $modules->get(InputfieldInteger);
$Deleted-> label = 'Deleted';
$Deleted-> attr('delete', 'Deleted');
$form->append($Deleted);

// DetailInformation einer Veranstaltung
$Title = $modules->get('InputfieldText');
$Title-> label = 'Title';
$Title-> attr('title', 'Title');
$form->append($Title);

$LocationName = $modules->get('InputfieldText');
$LocationName-> label = 'LocationName';
$LocationName-> attr('locationname', 'LocationName'); 
$form->append($LocationName);

// ActivityDates
$StartDate = $modules->get('InputfieldDatetime');
$StartDate-> label = 'StartDate';
$StartDate-> attr('startdate', 'StartDate');
$form->append($StartDate);

}
}

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...