function updateFieldLabels(&$labels)
 {
     parent::updateFieldLabels($labels);
     $labels['Priority'] = _t('SiteTree.METAPAGEPRIO', "Page Priority");
 }
 function onBeforeWrite()
 {
     if (!$this->owner->ID && !$this->owner->SubsiteID) {
         $this->owner->SubsiteID = Subsite::currentSubsiteID();
     }
     // If the content has been changed, then the page should be marked as 'custom content'
     if (!$this->nextWriteDoesntCustomise && $this->owner->ID && $this->owner->MasterPageID && !$this->owner->CustomContent) {
         $changed = $this->owner->getChangedFields();
         foreach (self::$template_fields as $field) {
             if (isset($changed[$field]) && $changed[$field]) {
                 $this->owner->CustomContent = true;
                 FormResponse::add("if(\$('Form_EditForm_CustomContent')) \$('Form_EditForm_CustomContent').checked = true;");
                 break;
             }
         }
     }
     $this->nextWriteDoesntCustomise = false;
     parent::onBeforeWrite();
 }
	public function onAfterWrite(){
		
		if(self::$update_meta_title == 1 || self::$update_meta_desc == 1 || self::$update_meta_keys == 1){
			// TODO : find a nicer way to reload the page 
			LeftAndMain::ForceReload ();
		}
		parent::onAfterWrite ();
	}
 /**
  * Do stuff before the decorated object is deleted.
  * In this case rename the associated folder.
  *
  */
 function onBeforeUnpublish()
 {
     parent::onBeforeUnpublish();
     $folder = $this->owner->AssociatedFolder();
     if ($folder) {
         $folder->Name = $this->owner->URLSegment . '__deleted';
         $folder->write();
     } else {
         trigger_error("Associated folder does not exist", E_USER_ERROR);
     }
 }