attach_rule function

Internal function that creates the rule for a specific setting or behavior of the modal.