Jump to content

Module Creation_____ (I have tried to create a module, but it seems there is a problem. Could someone please help me to find my error). THANK YOU


Abe Cube
 Share

Recommended Posts

<?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);

}
}

?>

processwire Error 2.png

ProcessWire Error.png

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...