public function getCMSFields()
    {
        $this->beforeUpdateCMSFields(function ($fields) {
            // Go through a convoluted process to find out field group
            // as the default fieldlist doesn't seem to register it!
            $main = $fields->findOrMakeTab("Root.Main");
            $details = null;

            $enddate_field = $fields->dataFieldByName("EndDate");
            $enddate_field->setTitle(_t("OrdersAdmin.Due", "Due"));

            // Manually loop through fields to find info composite field, as
            // fieldByName cannot reliably find this.
            foreach ($main->getChildren() as $field) {
                if ($field->getName() == "OrdersDetails") {
                    foreach ($field->getChildren() as $field) {
                        if ($field->getName() == "OrdersDetailsInfo") {
                            $details = $field;
                        }
                    }
                }
            }

            if ($details) {
                $details->insertBefore(
                    "StartDate",
                    DropdownField::create(
                        'Status',
                        null,
                        $this->config()->get("statuses")
                    )
                );
            }
        });

        return parent::getCMSFields();
    }
public function getCMSFields()
    {
        $this->beforeUpdateCMSFields(function ($fields) {
            // Go through a convoluted process to find out field group
            // as the default fieldlist doesn't seem to register it!
            $main = $fields->findOrMakeTab("Root.Main");
            $details = null;

            $enddate_field = $fields->dataFieldByName("EndDate");
            $enddate_field->setTitle(_t("OrdersAdmin.Due", "Due"));

            // Manually loop through fields to find info composite field, as
            // fieldByName cannot reliably find this.
            foreach ($main->getChildren() as $field) {
                if ($field->getName() == "OrdersDetails") {
                    foreach ($field->getChildren() as $field) {
                        if ($field->getName() == "OrdersDetailsInfo") {
                            $details = $field;
                        }
                    }
                }
            }

            if ($details) {
                $details->insertBefore(
                    "StartDate",
                    DropdownField::create(
                        'Status',
                        null,
                        $this->config()->get("statuses")
                    )
                );
            }
        });

        return parent::getCMSFields();
    }
public function getCMSFields ( ) { $ this -> beforeUpdateCMSFields ( function ( $ fields ) { // Go through a convoluted process to find out field group // as the default fieldlist doesn't seem to register it! $ main = $ fields -> findOrMakeTab ( "Root.Main" ) ; $ details = null ; $ enddate_field = $ fields -> dataFieldByName ( "EndDate" ) ; $ enddate_field -> setTitle ( _t ( "OrdersAdmin.Due" , "Due" ) ) ; // Manually loop through fields to find info composite field, as // fieldByName cannot reliably find this. foreach ( $ main -> getChildren ( ) as $ field ) { if ( $ field -> getName ( ) == "OrdersDetails" ) { foreach ( $ field -> getChildren ( ) as $ field ) { if ( $ field -> getName ( ) == "OrdersDetailsInfo" ) { $ details = $ field ; } } } } if ( $ details ) { $ details -> insertBefore ( "StartDate" , DropdownField :: create ( 'Status' , null , $ this -> config ( ) -> get ( "statuses" ) ) ) ; } } ) ; return parent :: getCMSFields ( ) ; }
Scaffold admin form feilds

@return FieldList
Scaffold admin form feilds