public static function toggle($field, $status = null)
	{
		// If we're toggling field based on position in array
		if (strlen($field) == 1 && is_numeric($field))
		{
			$i = 0;
			foreach (static::$fields as $f => $s)
			{
				if ($i == $field)
				{
					if (!isset($status))
					{
						$status = ($s) ? false : true;
					}

					static::$fields[$f] = $status;

					// Return textual description of what happened
					return (($status) ? 'Showing ' : 'Hiding ') . $f;
				}
				$i++;
			}
		}
		// All fields either on or off
		else if ($field == 'all')
		{
			foreach (static::$fields as $f => $s)
			{
				static::$fields[$f] = $status;
			}

			return (($status) ? 'Showing ' : 'Hiding ') . 'all fields';
		}
		// Toggling comma-separated list of fields
		else if (strpos($field, ','))
		{
			$fields = explode(',', $field);
			$valid  = array();

			foreach ($fields as $f)
			{
				$f = trim($f);
				if (isset(static::$fields[$f]))
				{
					$valid[] = $f;
					static::$fields[$f] = $status;
				}
			}

			$return = (($status) ? 'Showing ' : 'Hiding ');
			if (empty($valid))
			{
				$return = 'No valid fields provided';
			}
			else
			{
				$return .= implode(', ', $valid);
			}

			return $return;
		}
		// Toggling single field
		else if (isset(static::$fields[$field]))
		{
			static::$fields[$field] = $status;

			return (($status) ? 'Showing ' : 'Hiding ') . $field;
		}
		// Who knows what's going on here!
		else
		{
			return false;
		}
	}
public static function toggle($field, $status = null)
	{
		// If we're toggling field based on position in array
		if (strlen($field) == 1 && is_numeric($field))
		{
			$i = 0;
			foreach (static::$fields as $f => $s)
			{
				if ($i == $field)
				{
					if (!isset($status))
					{
						$status = ($s) ? false : true;
					}

					static::$fields[$f] = $status;

					// Return textual description of what happened
					return (($status) ? 'Showing ' : 'Hiding ') . $f;
				}
				$i++;
			}
		}
		// All fields either on or off
		else if ($field == 'all')
		{
			foreach (static::$fields as $f => $s)
			{
				static::$fields[$f] = $status;
			}

			return (($status) ? 'Showing ' : 'Hiding ') . 'all fields';
		}
		// Toggling comma-separated list of fields
		else if (strpos($field, ','))
		{
			$fields = explode(',', $field);
			$valid  = array();

			foreach ($fields as $f)
			{
				$f = trim($f);
				if (isset(static::$fields[$f]))
				{
					$valid[] = $f;
					static::$fields[$f] = $status;
				}
			}

			$return = (($status) ? 'Showing ' : 'Hiding ');
			if (empty($valid))
			{
				$return = 'No valid fields provided';
			}
			else
			{
				$return .= implode(', ', $valid);
			}

			return $return;
		}
		// Toggling single field
		else if (isset(static::$fields[$field]))
		{
			static::$fields[$field] = $status;

			return (($status) ? 'Showing ' : 'Hiding ') . $field;
		}
		// Who knows what's going on here!
		else
		{
			return false;
		}
	}
public static function toggle ( $ field , $ status = null ) { // If we're toggling field based on position in array if ( strlen ( $ field ) == 1 && is_numeric ( $ field ) ) { $ i = 0 ; foreach ( static :: $ fields as $ f => $ s ) { if ( $ i == $ field ) { if ( ! isset ( $ status ) ) { $ status = ( $ s ) ? false : true ; } static :: $ fields [ $ f ] = $ status ; // Return textual description of what happened return ( ( $ status ) ? 'Showing ' : 'Hiding ' ) . $ f ; } $ i ++ ; } } // All fields either on or off else if ( $ field == 'all' ) { foreach ( static :: $ fields as $ f => $ s ) { static :: $ fields [ $ f ] = $ status ; } return ( ( $ status ) ? 'Showing ' : 'Hiding ' ) . 'all fields' ; } // Toggling comma-separated list of fields else if ( strpos ( $ field , ',' ) ) { $ fields = explode ( ',' , $ field ) ; $ valid = array ( ) ; foreach ( $ fields as $ f ) { $ f = trim ( $ f ) ; if ( isset ( static :: $ fields [ $ f ] ) ) { $ valid [ ] = $ f ; static :: $ fields [ $ f ] = $ status ; } } $ return = ( ( $ status ) ? 'Showing ' : 'Hiding ' ) ; if ( empty ( $ valid ) ) { $ return = 'No valid fields provided' ; } else { $ return .= implode ( ', ' , $ valid ) ; } return $ return ; } // Toggling single field else if ( isset ( static :: $ fields [ $ field ] ) ) { static :: $ fields [ $ field ] = $ status ; return ( ( $ status ) ? 'Showing ' : 'Hiding ' ) . $ field ; } // Who knows what's going on here! else { return false ; } }
Toggle field visibility

@return  string|bool
Toggle field visibility