Abe Cube Posted December 13, 2021 Share Posted December 13, 2021 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 More sharing options...
zoeck Posted December 13, 2021 Share Posted December 13, 2021 Do you mean something like "Fieldset in Tab (Open)" (Class: FieldtypeFieldsetTabOpen)? This is included in the Processwire core ? 1 Link to comment Share on other sites More sharing options...
Zeka Posted December 13, 2021 Share Posted December 13, 2021 Hi @Abe Cube I you are talking about ProcessPageEdit screen, that you can add runtime fields via hook. You can find some info there 1 Link to comment Share on other sites More sharing options...
Abe Cube Posted December 14, 2021 Author Share Posted December 14, 2021 THANKS Zeka, but there is a problem. I got some errors when I try to intall or upload the/a plugin(module). On line 41 I have ($fom->append($OriginId)). By the way, thank you so much for the reply Link to comment Share on other sites More sharing options...
Zeka Posted December 14, 2021 Share Posted December 14, 2021 @Abe Cube Which module? Link to comment Share on other sites More sharing options...
Abe Cube Posted December 14, 2021 Author Share Posted December 14, 2021 <?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 More sharing options...
Abe Cube Posted December 14, 2021 Author Share Posted December 14, 2021 I also tried to implement the code that you shared. There I got the error that I shared. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now