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


923 Views

Avatar
Nivanka

Community Member, 400 Posts

17 November 2008 at 6:41am

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