private function multipleNewsHolderPages()
    {
        $enabled = false;
        // If we have translations, disable translation filter to get all pages.
        if (class_exists('Translatable')) {
            $enabled = Translatable::disable_locale_filter();
        }
        $pages = Versioned::get_by_stage('NewsHolderPage', 'Live');
        // Only add the page-selection if there are multiple. Otherwise handled by onBeforeWrite();
        if ($pages->count() > 1) {
            $pagelist = array();
            if (class_exists('Translatable')) {
                foreach ($pages as $page) {
                    $pagelist['Root.Main'][$page->ID] = $page->Title . ' ' . $page->Locale;
                }
            } else {
                $pagelist = $pages->map('ID', 'Title')->toArray();
            }
            $this->field_list['Root.Main'][1] = ListboxField::create('NewsHolderPages', $this->owner->fieldLabel('NewsHolderPages'), $pagelist);
            $this->field_list['Root.Main'][1]->setMultiple(true);
        }
        if ($enabled) {
            Translatable::enable_locale_filter();
        }
    }
private function multipleNewsHolderPages()
    {
        $enabled = false;
        // If we have translations, disable translation filter to get all pages.
        if (class_exists('Translatable')) {
            $enabled = Translatable::disable_locale_filter();
        }
        $pages = Versioned::get_by_stage('NewsHolderPage', 'Live');
        // Only add the page-selection if there are multiple. Otherwise handled by onBeforeWrite();
        if ($pages->count() > 1) {
            $pagelist = array();
            if (class_exists('Translatable')) {
                foreach ($pages as $page) {
                    $pagelist['Root.Main'][$page->ID] = $page->Title . ' ' . $page->Locale;
                }
            } else {
                $pagelist = $pages->map('ID', 'Title')->toArray();
            }
            $this->field_list['Root.Main'][1] = ListboxField::create('NewsHolderPages', $this->owner->fieldLabel('NewsHolderPages'), $pagelist);
            $this->field_list['Root.Main'][1]->setMultiple(true);
        }
        if ($enabled) {
            Translatable::enable_locale_filter();
        }
    }
private function multipleNewsHolderPages ( ) { $ enabled = false ; // If we have translations, disable translation filter to get all pages. if ( class_exists ( 'Translatable' ) ) { $ enabled = Translatable :: disable_locale_filter ( ) ; } $ pages = Versioned :: get_by_stage ( 'NewsHolderPage' , 'Live' ) ; // Only add the page-selection if there are multiple. Otherwise handled by onBeforeWrite(); if ( $ pages -> count ( ) > 1 ) { $ pagelist = array ( ) ; if ( class_exists ( 'Translatable' ) ) { foreach ( $ pages as $ page ) { $ pagelist [ 'Root.Main' ] [ $ page -> ID ] = $ page -> Title . ' ' . $ page -> Locale ; } } else { $ pagelist = $ pages -> map ( 'ID' , 'Title' ) -> toArray ( ) ; } $ this -> field_list [ 'Root.Main' ] [ 1 ] = ListboxField :: create ( 'NewsHolderPages' , $ this -> owner -> fieldLabel ( 'NewsHolderPages' ) , $ pagelist ) ; $ this -> field_list [ 'Root.Main' ] [ 1 ] -> setMultiple ( true ) ; } if ( $ enabled ) { Translatable :: enable_locale_filter ( ) ; } }
If there are multiple @link NewsHolderPage available, add the field for multiples.
This includes translation options
If there are multiple