Robisz rozszerzenie do: applications/cms/sources/Records/Records.php
/**
* Get elements for add/edit form
*
* @param \IPS\Content\Item|NULL $item The current item if editing or NULL if creating
* @param \IPS\Node\Model|NULL $container Container (e.g. forum), if appropriate
* @return array
*/
public static function formElements( $item=NULL, \IPS\Node\Model $container=NULL )
{
Ta metoda zwraca $formElements, więc dla zwróconej wartości przed przekazaniem jej dalej dajesz tak jak niżej. Przykładowe dwa pola o ID 3 i 4:
Kod z testów (na sztywno ww. pliku, ale Ty zrób Plugin):
if ( \count( $options ) or \count( $toggles ) )
{
$formElements['create_record_state'] = new \IPS\Helpers\Form\CheckboxSet( 'create_record_state', $values, FALSE, array(
'options' => $options,
'toggles' => $toggles,
'multiple' => TRUE
) );
}
#elInput_content_field_3
#elInput_content_field_4
$formElements['field_3']->value = isset( \IPS\Request::i()->ocena ) ? \IPS\Request::i()->ocena : NULL;
$formElements['field_4']->value = isset( \IPS\Request::i()->poziom ) ? \IPS\Request::i()->poziom : NULL;
return $formElements;
}