<?php namespace ProcessWire;

/**
 * ProcessWire Title Fieldtype
 *
 * Field that holds a Page title 
 *
 * For documentation about the fields used in this class, please see:  
 * /wire/core/Fieldtype.php
 * 
 * ProcessWire 3.x, Copyright 2016 by Ryan Cramer
 * https://processwire.com
 *
 *
 */

class FieldtypePageTitle extends FieldtypeText implements FieldtypePageTitleCompatible {

	public static function getModuleInfo() {
		return array(
			'title' => 'Page Title',
			'version' => 100,
			'summary' => 'Field that stores a page title',
			'permanent' => true, 
			);
	}

	public static $languageSupport = false; 

	/**
	 * This field is only used for new fields in advanced mode
	 *
	 */
	public function isAdvanced() {
		return true; 
	}

	public function ___getCompatibleFieldtypes(Field $field) {
		$fieldtypes = $this->wire(new Fieldtypes());
		foreach($this->wire('fieldtypes') as $fieldtype) {
			if($fieldtype instanceof FieldtypePageTitleCompatible) {
				$fieldtypes->add($fieldtype);
			}
		}
		return $fieldtypes;
	}

	public function getInputfield(Page $page, Field $field) {
		$inputField = $this->modules->get('InputfieldPageTitle'); 
		return $inputField; 
	}

}

