<?php
namespace SabaiApps\Directories\Component\User\FieldRenderer;

use SabaiApps\Directories\Component\Entity\FieldRenderer\AbstractPermalinkFieldRenderer;
use SabaiApps\Directories\Component\Field\IField;
use SabaiApps\Directories\Component\Entity\Type\IEntity;

class NameFieldRenderer extends AbstractPermalinkFieldRenderer {

	protected function _fieldRendererSettingsForm( IField $field, array $settings, array $parents = array() ) {
		$form = parent::_fieldRendererSettingsForm( $field, $settings, $parents );
		unset( $form['link_custom_label'] );
		$form += $this->_application->Field_Type( 'name' )->formatNameSettingsForm( $settings, $parents );

		return $form;
	}

	protected function _getTitle( IField $field, array &$settings, IEntity $entity, array $values ) {
		return $this->_application->Field_Type( 'name' )->formatName( $values[0], $settings );
	}
}
