public function NumberOfStagesWithStops()
 {
     if (Stage::get()) {
         $stage = ProcessStage::get()->filter("ParentID", $this->ID)->Count();
         $stop = ProcessStopStage::get()->filter("ParentID", $this->ID)->Count();
         return $stage + $stop;
     } else {
         return 0;
     }
 }
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->removeByName('Order');
        $fields->removeByName('Content');
        $fields->removeByName('ProcessCaseID');
        $case = ProcessCase::get();
        if ($case) {
            $fields->insertBefore($caseOptions = new DropdownField('ProcessCaseID', 'Case', $case->map('ID', 'Title')), 'StageID');
            $caseOptions->setEmptyString('All');
        }
        $fields->insertAfter(new HiddenField("TypeOrder"), 'TypeID');
        $fields->insertAfter($content = new HTMLEditorField("Content"), 'ProcessCaseID');
        $content->setRows(15);
        $fields->insertAfter($links = new DropdownField('LinksToAnotherStageID', 'Links To Another Stage', Stage::get()->map('ID', 'Title')), 'StageID');
        $links->setEmptyString(' ');
        $fields->insertBefore(new LiteralField('InfoTitle', '<h3 class="process-info-header">
			<span class="step-label">
				<span class="flyout">5</span><span class="arrow"></span>
				<span class="title">Information Piece</span>
			</span>
		</h3>'), 'Title');
        return $fields;
    }