Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

adding a HasManyComplexTableField to a popup


Reply

878 Views

Avatar
Nivanka

17 November 2008 at 6:41am Community Member, 395 Posts

I need to add a HasManyComplexTableField to a popup block,

Can I do this?

<?php

class Concert extends DataObject{

   static $db = array(
      "Content" => "Text"
   );

   static $has_one = array(
      "Ticket" => "TicketsPage"
   );

   static $has_many = array(
      "Seats" => "Seat"
   );

   function getCMSFields_forPopup(){

      $fields = new FieldSet();

      $fields->push(new TextField( 'Content', 'Content' ));

      $tablefield = new HasOneComplexTableField(
         $this,
         'Seats',
         'Seat',
         array(
            'Content' => 'Content',
            'Price' => 'Price'
         ),
         'getCMSFields_forPopup'
      );
      $tablefield->setAddTitle('Seats');

      $fields->push($tablefield);

      return $fields;

   }
}

?>

this is my code