示例#1
0
文件: node.php 项目: hungnv0789/vhtm
	/**
	 * Validates a layout id
	 *
	 * @param mixed $value						- The value to validate
	 * @param mixed $error						- The var to assign an error to
	 * @return mixed | bool						- The filtered value or boolean false
	 */
	protected function validateLayoutID($value, &$error)
	{
		//If the value is 0, we're just setting to default.
		if (("" === $value) OR ($value < 1) OR (NULL === $value))
		{
			return $this->raw_fields['layoutid'] = NULL;
		}
		$layout = new vBCms_Item_Layout($value);

		if ($layout->isValid())
		{
			return $value;
		}

		return false;
	}
示例#2
0
	/**
	 * Fetches the layout.
	 *
	 * @return vBCms_Item_Layout
	 */
	public function getLayout()
	{
		//Layouts are assigned for sections only.
		if (!$this->layout)
		{
			// ensure parent info is loaded
			$this->Load(self::INFO_PARENTS);

			//See if we have a layoutid.

			$this->layout = new vBCms_Item_Layout($this->getLayoutId());
			$this->layout->requireInfo(vBCms_Item_Layout::INFO_CONFIG | vBCms_Item_Layout::INFO_WIDGETS);

			if (!$this->layout->isValid())
			{
				throw (new vB_Exception_Model('Layout item object not valid for node item'));
			}
		}

		return $this->layout;
	}