src/Extension/FluentSiteTreeExtension.php
protected function addLocaleStatusMessage(FieldList $fields)
    {
        // Don't display these messages if the owner class has asked us not to.
        if (!$this->owner->config()->get('locale_published_status_message')) {
            return;
        }

        // If the field is already present, don't add it a second time.
        if ($fields->fieldByName('LocaleStatusMessage')) {
            return;
        }

        // We don't need to add a status warning if a version of this Page has already been published for this Locale.
        if ($this->isPublishedInLocale()) {
            return;
        }

        $message = null;

        if ($this->owner->config()->get('frontend_publish_required')) {
            // If publishing is required, then we can just check whether or not this locale has been published.
            if (!$this->isPublishedInLocale()) {
                $message = _t(
                    __CLASS__ . '.LOCALESTATUSFLUENTINVISIBLE',
                    'This page will not be visible in this locale until it has been published.'
                );
            }
        } else {
            // If frontend publishing is *not* required, then we have two possibilities.
            if (!$this->isDraftedInLocale()) {
                // Our content hasn't been drafted or published. If this Locale has a Fallback, then content might be
                // getting inherited from that Fallback.
                $message = _t(
                    __CLASS__ . '.LOCALESTATUSFLUENTINHERITED',
                    'Content for this page may be inherited from another locale. If you wish you make an ' .
                    'independent copy of this page, please use one of the "Copy" actions provided.'
                );
            } elseif (!$this->isPublishedInLocale()) {
                // Our content has been saved to draft, but hasn't yet been published. That published content may be
                // coming from a Fallback.
                $message = _t(
                    __CLASS__ . '.LOCALESTATUSFLUENTDRAFT',
                    'A draft has been created for this locale, however, published content may still be ' .
                    'inherited from another. To publish this content for this locale, use the "Save & publish" ' .
                    'action provided.'
                );
            }
        }

        if ($message === null) {
            return;
        }

        $fields->unshift(
            LiteralField::create(
                'LocaleStatusMessage',
                sprintf(
                    '<p class="alert alert-info">%s</p>',
                    $message
                )
            )
        );
    }
protected function addLocaleStatusMessage(FieldList $fields)
    {
        // Don't display these messages if the owner class has asked us not to.
        if (!$this->owner->config()->get('locale_published_status_message')) {
            return;
        }

        // If the field is already present, don't add it a second time.
        if ($fields->fieldByName('LocaleStatusMessage')) {
            return;
        }

        // We don't need to add a status warning if a version of this Page has already been published for this Locale.
        if ($this->isPublishedInLocale()) {
            return;
        }

        $message = null;

        if ($this->owner->config()->get('frontend_publish_required')) {
            // If publishing is required, then we can just check whether or not this locale has been published.
            if (!$this->isPublishedInLocale()) {
                $message = _t(
                    __CLASS__ . '.LOCALESTATUSFLUENTINVISIBLE',
                    'This page will not be visible in this locale until it has been published.'
                );
            }
        } else {
            // If frontend publishing is *not* required, then we have two possibilities.
            if (!$this->isDraftedInLocale()) {
                // Our content hasn't been drafted or published. If this Locale has a Fallback, then content might be
                // getting inherited from that Fallback.
                $message = _t(
                    __CLASS__ . '.LOCALESTATUSFLUENTINHERITED',
                    'Content for this page may be inherited from another locale. If you wish you make an ' .
                    'independent copy of this page, please use one of the "Copy" actions provided.'
                );
            } elseif (!$this->isPublishedInLocale()) {
                // Our content has been saved to draft, but hasn't yet been published. That published content may be
                // coming from a Fallback.
                $message = _t(
                    __CLASS__ . '.LOCALESTATUSFLUENTDRAFT',
                    'A draft has been created for this locale, however, published content may still be ' .
                    'inherited from another. To publish this content for this locale, use the "Save & publish" ' .
                    'action provided.'
                );
            }
        }

        if ($message === null) {
            return;
        }

        $fields->unshift(
            LiteralField::create(
                'LocaleStatusMessage',
                sprintf(
                    '<p class="alert alert-info">%s</p>',
                    $message
                )
            )
        );
    }
protected function addLocaleStatusMessage ( FieldList $ fields ) { // Don't display these messages if the owner class has asked us not to. if ( ! $ this -> owner -> config ( ) -> get ( 'locale_published_status_message' ) ) { return ; } // If the field is already present, don't add it a second time. if ( $ fields -> fieldByName ( 'LocaleStatusMessage' ) ) { return ; } // We don't need to add a status warning if a version of this Page has already been published for this Locale. if ( $ this -> isPublishedInLocale ( ) ) { return ; } $ message = null ; if ( $ this -> owner -> config ( ) -> get ( 'frontend_publish_required' ) ) { // If publishing is required, then we can just check whether or not this locale has been published. if ( ! $ this -> isPublishedInLocale ( ) ) { $ message = _t ( __CLASS__ . '.LOCALESTATUSFLUENTINVISIBLE' , 'This page will not be visible in this locale until it has been published.' ) ; } } else { // If frontend publishing is *not* required, then we have two possibilities. if ( ! $ this -> isDraftedInLocale ( ) ) { // Our content hasn't been drafted or published. If this Locale has a Fallback, then content might be // getting inherited from that Fallback. $ message = _t ( __CLASS__ . '.LOCALESTATUSFLUENTINHERITED' , 'Content for this page may be inherited from another locale. If you wish you make an ' . 'independent copy of this page, please use one of the "Copy" actions provided.' ) ; } elseif ( ! $ this -> isPublishedInLocale ( ) ) { // Our content has been saved to draft, but hasn't yet been published. That published content may be // coming from a Fallback. $ message = _t ( __CLASS__ . '.LOCALESTATUSFLUENTDRAFT' , 'A draft has been created for this locale, however, published content may still be ' . 'inherited from another. To publish this content for this locale, use the "Save & publish" ' . 'action provided.' ) ; } } if ( $ message === null ) { return ; } $ fields -> unshift ( LiteralField :: create ( 'LocaleStatusMessage' , sprintf ( '<p class="alert alert-info">%s</p>' , $ message ) ) ) ; }
Adds a UI message to indicate whether you're editing in the default locale or not

@param  FieldList $fields
Adds a UI message to indicate whether you re editing in the default locale or not