protected function getEditor()
	{
		// Only create the editor if it is not already created.
		if (empty($this->editor))
		{
			// Initialize variables.
			$editor = null;

			// Get the editor type attribute. Can be in the form of: editor="desired|alternative".
			$type = trim((string) $this->element['editor']);

			if ($type)
			{
				// Get the list of editor types.
				$types = explode('|', $type);

				// Get the database object.
				$db = App::get('db');

				// Iterate over teh types looking for an existing editor.
				foreach ($types as $element)
				{
					// Build the query.
					$query = $db->getQuery()
						->select('element')
						->from('#__extensions')
						->whereEquals('element', $element)
						->whereEquals('folder', 'editors')
						->whereEquals('enabled', '1')
						->limit(1)
						->start(0);

					// Check of the editor exists.
					$db->setQuery($query->toString());
					$editor = $db->loadResult();

					// If an editor was found stop looking.
					if ($editor)
					{
						break;
					}
				}
			}

			// Create the Editor instance based on the given editor.
			$this->editor = $editor ? Wysiwyg::getInstance($editor) : App::get('editor');
		}

		return $this->editor;
	}