get( 'field_' . $key, 1 ); } return false; } /** * True when some route cannot be filed without this field. * * Only the reason and the description can be required that way: the reason by * the route's own setting, and the description alongside it on a route that * asks for both (the one that reports a fault, which cannot be looked into * without one). */ private static function required_by_a_route( $key, Settings $settings ) { if ( 'reason' !== $key && 'comment' !== $key ) { return false; } foreach ( Routes::keys() as $route ) { // A route the customer cannot reach requires nothing of the form. if ( ! Routes::offered( $route, $settings ) ) { continue; } if ( 'required' !== Reasons::mode( $route, $settings ) ) { continue; } if ( 'reason' === $key || Routes::property( $route, 'comment_with_reason' ) ) { return true; } } return false; } /** Flags handed to the front end so the script renders the same set. */ public static function flags( Settings $settings ) { $out = array(); foreach ( self::TOGGLEABLE as $key ) { $out[ $key ] = self::is_enabled( $key, $settings ); } return $out; } }