Contextually grey out panel element in python 2.8
Set UILayout.enabled


  UILayout.enabled
  
  When false, this (sub)layout is grayed out


eg enable subrow in a row if context object has rigid body settings

row = self.layout.row()
sub = row.row()
sub.enabled = context.object.rigidbody is not None
sub.prop(foo, "bar")


Note that context is passed as an argument to draw methods.  Get out of the, IMO, bad habit of always addressing from bpy ie if in a draw method def draw(self, context): use context in method code not bpy.context.

The poll method works on a per Panel or Menu or Operator class et al case.  The following will ensure FooPanel only draws when there is a context object.

class FooPanel(bpy.types.Panel):

    @classmethod
    def poll(cls, context):
        return context.object is not None


panels that don't poll don't show. Operators are disabled if in layout but don't poll.  It is important to have a  poll method in most cases.

Re versions, both layout enabled and poll method are avalable in all versions >= 2.50.