Drupal : Création d'un tableau

Salut,

L'objectif de ce billet est d'expliquer comment créer afficher un tableau sous Drupal à l'intérieur d'un Formulaire. Par défaut, le tableau dans un formulaire Drupal est utilisé pour choisir ou cocher une ligne. C'est pour cette raison lorsque qu'on l'affiche on voit toujours la première colonne contient des cases à cocher. L’objectif de ce billet est d'essayer d'afficher le tableau sans les cases à cocher. 


Création d'un tableau sous Drupal

Avant de créer le tableau il faut tout d'abord commencer à créer le formulaire. Sous drupal pour créer un formulaire il faut commencer par créer le tableau $form et à la fin retourner la valeur de ce tableau :

$form = array();

Création des différents champs

return $form;

Ensuite on commence à créer nos différents champs

$form = array();

$form['debut-heur'] = array(    // Création d'un champ text
                    '#type' => 'textfield',
                    '#title' => t('Start hour'),
                    '#maxlength' => 10,
                    '#size' => 8,
 );

$form['gps_module'] = array(  // Création d'un champ select
                '#type' => 'select',
                '#title' => t('GPS Module'),
                '#options' => $module_gps_libelle,
                '#weight' => 1,
    );

return $form;

Nous créons maintenant le tableau par défaut dans un formulaire sous Drupal. Pour créer un tableau il faut ajouter la valeur ' tableselect' au paramètre #type.

$form['table'] = array(
                '#type' => 'tableselect',
                '#title' => t('Current affectation table'),
                '#header' => $header,
                '#options' => $rows                
                );

Le tableau obtenu ressemble à celui de l'image suivante :

Tableau Drupal avec case à cocher

Image 1 : Tableau par défaut de Drupal avec case à cocher

On constate très bien que nous avons les cases à cocher. Pour enlever ces cases à cocher il faut ajouter les lignes suivantes en dessous du tableau crée :

foreach( $rows as $key => $value )
{
  $form['table'][$key]['#disabled'] = true;
}

Et ensuite on obtient notre nouveau tableau :

   Tableau Drupal avec case à cocher

Image 2 : Tableau par défaut de Drupal sans case à cocher

 

Code complet

Je vous remte içi le code complet :

$form = array();

$form['debut-heur'] = array(    // Création d'un champ text
                    '#type' => 'textfield',
                    '#title' => t('Start hour'),
                    '#maxlength' => 10,
                    '#size' => 8,
 );

$form['gps_module'] = array(  // Création d'un champ select
                '#type' => 'select',
                '#title' => t('GPS Module'),
                '#options' => $module_gps_libelle,
                '#weight' => 1,
    );

while($row = db_fetch_array($query)) {

 
$rows[$row ['id']] = array(
                            'vehicle'=>$row['vehicle'],
                            'terminal'=>$row['terminal'],
                            'start_date'=>date('d/m/Y',$row['start_date']),
                            'end_date'=>date('d/m/Y',$row['end_date']),
);
}

$header = array('vehicle'=> t('vehicle'), 'terminal'=> t('terminal'), 'start_date'=> t('start_date'),'end_date'=> t('end_date'));

$form['table'] = array(
                '#type' => 'tableselect',
                '#title' => t('Current affectation table'),
                '#header' => $header,
                '#options' => $rows                
                );

foreach( $rows as $key => $value )
{
  $form['table'][$key]['#disabled'] = true;
}

return $form;

Commentaires

alone in the dark game free download for pcadobe illustrator cc custom keyboard shortcuts free downloadblack buccaneer pc game downloadmicrosoft office 2016 trial version free downloadldp download windows 10ms office word 2007 free download for windows 10 free downloadwindows 10 enterprise activator free download for 64 bit free downloadfree download intel sound drivers for windows xp freedownload driver canon lbp 800 windows xp freedownload skype for windows 10 offline installer
https://bit.ly/2VUOL2A
https://bit.ly/3BwfK4M

nvidia quadro fx 3450/4000 sdi
belkin wireless g plus mimo
apple ipad air 2 manual free download
download wa gratis
gigabyte z77-hd3

https://bit.ly/3erzqNp
https://bit.ly/3hKWlFk

adobe premiere pro cc 2017 free download windows 10
windows 10 enterprise boot usb free download
autodesk 3ds max interactive 2019 v2.1.777.0 free download
download google chrome for windows 10 pro
windows mail download windows xp free
download sexy game for pc
download driver hp laserjet p1005 windows 10 64 bit
upgrade vmware workstation player 12 to 15 free download
pixelmator price mac app store free download
windows 7 setup download 32 bit free

https://bit.ly/3zk5Ile
https://bit.ly/3eDDc6p

[url=https://bit.ly/3kLvWcz]]captain america civil war game download for pc
[/url]
microsoft security essentials free download for windows xp sp2 free
have a great day gif
dxtory not recording video
miniclip 8 pool
mercedes e class manual download

gpu download windows 10microsoft word 2013 app free download free downloadadvanced systemcare download windows 10free download call of duty 4 full game for pcbollywood pc movie free downloaddownload game nba street v3 pcandroid toolkit free download for pcdownload windows 10 for acer laptopcar race game download for pc windows 8.14x4 hummer pc game free download
https://bit.ly/3iCzGdQ
https://bit.ly/3kwb1Kb

[url=https://bit.ly/3zjDBmm]]microsoft net framework 2.0 free download for windows xp free
[/url]
bramka sms t mobile
macrium reflect mac os x
tekken 1 game free download for android
symantec endpoint protection free download for windows 7 free
failed disk full chrome

picasa photo viewer free download for windows 10 free
assamese keyboard software free download
primavera manual pdf download
download windows vista sp2 32 bit free
asus prime z270-a drivers

https://bit.ly/3y2nfyn
https://bit.ly/3xXmuX9

[url=https://bit.ly/3rslCYm]]windows 7 ultimate with product key free download free download
[/url]
stellar phoenix windows data recovery download with crack freedownload pc screen capturethe chicago manual of style 17th edition pdf free downloadxtuservice 32 bitprenuptial agreement new mexico
[url=https://bit.ly/3kDYqot]]microsoft word 2016 crossword puzzle answers free download
[/url]
diablo 2 mac installerwinmountsublime text kuyhaamacro media fireworksdwonload counter strike
[url=https://bit.ly/3extq5D]]download texture packs for minecraft windows 10
[/url]
azurewave aw-ce123h driverfoxit editor downloadgis software free download windows 7 freesony kdl-60ex645polarity browser
[url=https://bit.ly/3izkbmR]]download dead by daylight pc free
[/url]
samsung series 9 touchpad driverpace anti-piracyanti terrorism shooter mod apksamsung ml-2851nd driverroxio windows 10
[url=https://bit.ly/2UHymy5]]3d game maker for pc free download
[/url]
helium music managermpegav to mp3 converterqualcomm lan killer e2201 driverfighting tiger game for pc free downloadsairat hd video songs download
[url=https://bit.ly/3eJzB6Y]]windows xp 32bit download free
[/url]
jiofi driver for windows xp downloaddownload microsoft powerpointld???? ????game aov pckuyhaa xampp
https://bit.ly/36KdkkP
https://bit.ly/3BlkJ8b
https://bit.ly/3BAFM6Q
https://bit.ly/3BgSTtO
https://bit.ly/3iGCDtH
https://bit.ly/3y00jzJ
https://bit.ly/3kI15h1
https://bit.ly/3y2EkrP
https://bit.ly/3iIpCzH
https://bit.ly/3kw34ot

[url=https://www.cshtr.com/24/74951-24-2001-5-sezon-hdtv-ff-nl-tb-download-in... franklin songs download free[/url]
[url=http://vututors.pk/community/computer-sciences-assignments-solutions-qui... speed up[/url]
[url=http://www.maeroonoopreterm.com/community/main-forum/free-windows-vista-... windows vista sound driver download free[/url]
[url=https://vezynok.ru/otzyvy/]windows movie xp maker free download free[/url]
[url=http://cnlongxing.com/guestbook_detail.php?id=2004448]harry potter and the deathly hallows game download[/url]

download microsoft word 2016 for windows 7 64 bit free downloadfruity loops free download for windows 8 freecall of duty ghosts 2 game download free for pcdanganronpa 2 free download pcgoogle earth download free 2018 windows 10 64 bitlaptop software download windows 10windows 10 pro media creation tool 64 bit free downloadfolder icons free download for windows 10audacity free download windows 8.1 freemicrosoft office 2016 stops responding free download
https://bit.ly/2UGoftk
https://bit.ly/3wQhRwC

windows 7 ultimate full drivers download free
rtl8185l
download sp 2 for windows xp free
security task manager download
fun for mobil com

https://bit.ly/3wNz35V
https://bit.ly/36MGEaC

google assistant for pc windows 10 free download
microsoft office word 2019 free download full version free download
download mysql server windows 10 64 bit
directx 10 download windows xp 32 bit free
dota 2 download pc windows 10
windows 10 win 7 interface free download
windows 10 enterprise 1809 download iso 64 bit deutsch free download
contraband police free download pc
contra download for pc free
fable 3 pc game download

https://bit.ly/3wMVmsz
https://bit.ly/2V0pTWP

[url=https://bit.ly/3z8xl0z]]pc games under 200mb download for windows 10
[/url]
english to oriya dictionary software free download for windows 7
download realtek hd audio driver for windows xp 32 bit free
fake id card maker for pc
download plants vs zombies full version free
pencil sketch software free download windows 7 free

microsoft office word 2013 portable free download free downloadmicrosoft excel has stopped working 2016 when opening file free download007 pc game downloadmicrosoft office professional plus 2013 problems free downloadcivilization 4 windows 10 downloadanaconda python 3.8 download for windows 10 64 bitarmored core pc game free downloadwindows 8 download youtube videos freefar cry pc game download highly compressedmicrosoft office 2016 pro professional plus cd-key (1 pc) free download
https://bit.ly/2UYRQOB
https://bit.ly/3z80Z6c

[url=https://bit.ly/3zroXJN]]cricket world cup 2018 games download pc
[/url]
microsoft wearable tech
pcsx2 1.5.0 dev
how to download songs from saavn to pc
2015 can am outlander service manual free download
swf opener download

ohel sarah amen group
magix music maker movie score edition
nova launcher prime apk 4.3 1
how to edit text paint.net
game maker megaman x engine

https://bit.ly/3izT2QF
https://bit.ly/2VQWjDn

[url=https://bit.ly/3iq7qLn]]java setup for windows 10 download
[/url]
asus usb 3.0 boost windows 10spybot checking for antispyware updatesvocaloid dress up gamebattle of jakku dlc pricedownload viber for pc windows 10 free
[url=https://bit.ly/3kRwjlN]]cara upgrade microsoft office 2007 ke 2010 gratis free download
[/url]
wwe 2k download for androidclipmate alternativezingbox manga downloadelna su sewing machine manual free downloadfree eset nod32 antivirus download for windows xp free
[url=https://bit.ly/2W2gRJ7]]sketchup pro 2016 94fbr free download
[/url]
adobe reader for windows xp sp2asus supremefx hi-fifree vob to wmv converterpdf creator download windows 7 free freedownload codec terbaru
[url=https://bit.ly/3kuU8zQ]]windows xp download free full version with key free
[/url]
nba live 09 apkne yo together downloadmotorola device manager downloadwinds pro 3ds emulator downloadfive nights at the krusty krab online
[url=https://bit.ly/3eEyOUA]]apple tv windows 10 download
[/url]
connectify hotspot pro free download for windows 8 with crack freebamboo dock 64 bitmemorex cd dvd writer machp laserjet pro mfp m128fw scanner drivershuttle sh67 xpc desktop review
[url=https://bit.ly/3wIWHk1]]download gujarati indic ime windows xp free
[/url]
gravity tweak no jailbreaksuzuki drz400e manual free downloadjava download free for windows 7 latest version freecoc unduhkinovea
https://bit.ly/3x0Tyfu
https://bit.ly/3BfKas0
https://bit.ly/34CKO3t
https://bit.ly/3hYW01W
https://bit.ly/2Tglv5t
https://bit.ly/3zaVl3l
https://bit.ly/2UeWF6A
https://bit.ly/3c9Ou0M
https://bit.ly/36Lgnt0
https://bit.ly/3ryqETa

[url=https://commonmanoz.com/community/main-forum/soy-de-rancho-el-komander-d... de rancho el komander descargar[/url]
[url=http://cnlongxing.com/guestbook_detail.php?id=2006563]rope and fly 2[/url]
[url=http://captainclever.com/rzz/community/main-forum/chhota-bheem-game-free... bheem game free download[/url]
[url=http://www.zimmer-suche.at/zimmersuche/kontakt.csp?NEWSLETTERADR=Meine Email-Adresse&QUICKFIND=&betreff=radmin 3.5 full&spamschutz=21&textarea_=&textarea_kontakt=microsoft visio 2010 requirements free downloaddownload kaun banega crorepati game for pcdownload game deadpool pc full versionwindows server 2008 r2 enterprise 32 bit free downloaddead by daylight free download on pcwindows 10 home 64 bit usb stick free downloaddownload microsoft office 2016 professional plus for windows pclogic pro x autotune preset free downloadwindows 10 delete $windows. bt folder free downloadcain and abel software download windows 10 https:/bit.ly/3BxU7B5 https:/bit.ly/3BtLrf4 belkin wireless usb hub sci fi alarm sound tag heuer cell phone hp scanjet 5370c driver leechget https:/bit.ly/2UoH30n https:/bit.ly/3rei8Zk windows 7 enterprise upgrade to windows 10 education free download balloon and arrow game free download for pc endnote x7 error searching for records free download download free pc movie&textarea_nachricht]radmin 3.5 full[/url]
[url=http://rkbvl.ru/forum/profile.php?mode=viewprofile&u=16089]nikon 1 s1 manual[/url]

Pages

Ajouter commentaire

Plain text

  • Aucune balise HTML autorisée.
  • Les adresses de pages web et de courriels sont transformées en liens automatiquement.
  • Les lignes et les paragraphes vont à la ligne automatiquement.
CAPTCHA
La question est pour vérifier si vous êtes un robot ou humain afin de se prévenir des spams.